Merge lp:~tualatrix/ibentu/gnome-terminal into lp:ibentu
- gnome-terminal
- Merge into ibentu-desktop-default-set...
Status: | Needs review |
---|---|
Proposed branch: | lp:~tualatrix/ibentu/gnome-terminal |
Merge into: | lp:ibentu |
Diff against target: |
453404 lines (+451801/-0) (has conflicts) 297 files modified
.pc/.version (+1/-0) .pc/01_lpi.patch/configure.ac (+195/-0) .pc/01_lpi.patch/src/terminal-window.c (+4026/-0) .pc/01_lpi.patch/src/terminal.xml (+116/-0) .pc/01_onlyshowin.patch/gnome-terminal.desktop.in.in (+14/-0) .pc/02_add_transparency_properties.patch/src/gnome-terminal.schemas.in (+1302/-0) .pc/02_add_transparency_properties.patch/src/profile-editor.c (+921/-0) .pc/02_add_transparency_properties.patch/src/profile-preferences.glade (+2814/-0) .pc/02_add_transparency_properties.patch/src/terminal-profile.c (+1690/-0) .pc/02_add_transparency_properties.patch/src/terminal-profile.h (+191/-0) .pc/02_add_transparency_properties.patch/src/terminal-screen.c (+2343/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/gnome-terminal.schemas.in (+1317/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/profile-editor.c (+932/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/profile-preferences.glade (+2833/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/terminal-profile.c (+1693/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/terminal-profile.h (+192/-0) .pc/20_add_alt_screen_toggle_ui.patch/src/terminal-screen.c (+2375/-0) .pc/applied-patches (+4/-0) AUTHORS (+3/-0) COPYING (+676/-0) ChangeLog (+47086/-0) ChangeLog.README (+16/-0) ChangeLog.pre-2-23 (+4754/-0) HACKING (+13/-0) Makefile.am (+64/-0) Makefile.in (+877/-0) NEWS (+730/-0) README (+19/-0) aclocal.m4 (+10078/-0) config.guess (+1501/-0) config.h.in (+107/-0) config.sub (+1705/-0) configure (+16194/-0) configure.ac (+196/-0) debian/changelog (+1829/-0) debian/compat (+1/-0) debian/control (+65/-0) debian/control.in (+60/-0) debian/copyright (+43/-0) debian/fonts.conf (+11/-0) debian/gnome-terminal-data.debhelper.log (+1/-0) debian/gnome-terminal-data.install (+7/-0) debian/gnome-terminal.debhelper.log (+1/-0) debian/gnome-terminal.install (+3/-0) debian/gnome-terminal.links (+1/-0) debian/gnome-terminal.manpages (+1/-0) debian/gnome-terminal.menu (+6/-0) debian/gnome-terminal.postinst (+13/-0) debian/gnome-terminal.prerm (+10/-0) debian/gnome-terminal.sgml (+223/-0) debian/gnome-terminal.wrapper (+81/-0) debian/gnome-terminal.xpm (+166/-0) debian/patches/01_lpi.patch (+47/-0) debian/patches/01_onlyshowin.patch (+11/-0) debian/patches/02_add_transparency_properties.patch (+330/-0) debian/patches/20_add_alt_screen_toggle_ui.patch (+148/-0) debian/patches/series (+4/-0) debian/rules (+21/-0) debian/source/format (+1/-0) debian/watch (+3/-0) depcomp (+630/-0) gnome-doc-utils.make (+655/-0) gnome-terminal.desktop.in.in (+15/-0) help/C/gnome-terminal.xml (+1140/-0) help/C/legal.xml (+76/-0) help/Makefile.am (+17/-0) help/Makefile.in (+1173/-0) help/bg/Makefile.am (+10/-0) help/bg/Makefile.in (+573/-0) help/bg/gnome-terminal-bg.omf (+18/-0) help/bg/gnome-terminal.xml (+943/-0) help/bg/legal.xml (+9/-0) help/ca/ca.po (+1967/-0) help/ca/gnome-terminal.xml (+963/-0) help/cs/cs.po (+1916/-0) help/cs/gnome-terminal.xml (+956/-0) help/da/da.po (+1921/-0) help/da/gnome-terminal.xml (+957/-0) help/de/de.po (+2018/-0) help/de/gnome-terminal.xml (+956/-0) help/el/el.po (+1985/-0) help/el/gnome-terminal.xml (+957/-0) help/en_GB/en_GB.po (+1918/-0) help/en_GB/gnome-terminal.xml (+957/-0) help/es/es.po (+1982/-0) help/es/gnome-terminal.xml (+956/-0) help/fr/fr.po (+1979/-0) help/fr/gnome-terminal.xml (+956/-0) help/gnome-terminal.omf.in (+9/-0) help/it/gnome-terminal.xml (+960/-0) help/it/it.po (+2052/-0) help/ja/Makefile.am (+10/-0) help/ja/Makefile.in (+573/-0) help/ja/gnome-terminal-ja.omf (+35/-0) help/ja/gnome-terminal.xml (+1388/-0) help/ja/legal.xml (+47/-0) help/ko/gnome-terminal.xml (+965/-0) help/ko/ko.po (+1824/-0) help/oc/gnome-terminal.xml (+1184/-0) help/oc/oc.po (+1532/-0) help/pt_BR/gnome-terminal.xml (+960/-0) help/pt_BR/pt_BR.po (+1203/-0) help/ro/Makefile.am (+10/-0) help/ro/Makefile.in (+573/-0) help/ro/gnome-terminal-ro.omf (+35/-0) help/ro/gnome-terminal.xml (+1403/-0) help/ro/legal.xml (+70/-0) help/ru/gnome-terminal.xml (+980/-0) help/ru/ru.po (+1121/-0) help/sv/gnome-terminal.xml (+963/-0) help/sv/sv.po (+1160/-0) help/uk/gnome-terminal.xml (+980/-0) help/uk/uk.po (+1936/-0) help/zh_CN/gnome-terminal.xml (+956/-0) help/zh_CN/zh_CN.po (+1788/-0) help/zh_TW/Makefile.am (+10/-0) help/zh_TW/Makefile.in (+573/-0) help/zh_TW/gnome-terminal-zh_TW.omf (+35/-0) help/zh_TW/gnome-terminal.xml (+1212/-0) help/zh_TW/legal.xml (+54/-0) install-sh (+520/-0) ltmain.sh (+8406/-0) missing (+376/-0) mkinstalldirs (+162/-0) omf.make (+61/-0) po/LINGUAS (+92/-0) po/Makefile.in.in (+217/-0) po/POTFILES.in (+28/-0) po/POTFILES.skip (+12/-0) po/am.po (+2483/-0) po/ar.po (+2786/-0) po/as.po (+2921/-0) po/ast.po (+2438/-0) po/az.po (+2719/-0) po/be.po (+2496/-0) po/be@latin.po (+2946/-0) po/bg.po (+2707/-0) po/bn.po (+2647/-0) po/bn_IN.po (+2660/-0) po/br.po (+2248/-0) po/bs.po (+2760/-0) po/ca.po (+3414/-0) po/ca@valencia.po (+3383/-0) po/cs.po (+2597/-0) po/cy.po (+3117/-0) po/da.po (+3329/-0) po/de.po (+3078/-0) po/dz.po (+2377/-0) po/el.po (+2977/-0) po/en@shaw.po (+2580/-0) po/en_CA.po (+2777/-0) po/en_GB.po (+3339/-0) po/eo.po (+2405/-0) po/es.po (+2922/-0) po/et.po (+2153/-0) po/eu.po (+2661/-0) po/fa.po (+2823/-0) po/fi.po (+3209/-0) po/fr.po (+2741/-0) po/fur.po (+2225/-0) po/ga.po (+2302/-0) po/gl.po (+2727/-0) po/gu.po (+2634/-0) po/he.po (+3302/-0) po/hi.po (+2289/-0) po/hr.po (+2704/-0) po/hu.po (+2663/-0) po/hy.po (+2048/-0) po/id.po (+2660/-0) po/it.po (+2720/-0) po/ja.po (+2707/-0) po/ka.po (+2786/-0) po/kk.po (+2402/-0) po/kn.po (+2670/-0) po/ko.po (+2632/-0) po/ku.po (+2542/-0) po/lt.po (+3165/-0) po/lv.po (+3188/-0) po/mai.po (+2022/-0) po/mg.po (+2897/-0) po/mk.po (+2701/-0) po/ml.po (+2649/-0) po/mn.po (+2656/-0) po/mr.po (+2612/-0) po/ms.po (+2727/-0) po/nb.po (+2671/-0) po/nds.po (+2018/-0) po/ne.po (+2553/-0) po/nl.po (+3395/-0) po/nn.po (+3078/-0) po/oc.po (+2434/-0) po/or.po (+2625/-0) po/pa.po (+2642/-0) po/pl.po (+2670/-0) po/ps.po (+1721/-0) po/pt.po (+3382/-0) po/pt_BR.po (+2740/-0) po/ro.po (+2648/-0) po/ru.po (+2209/-0) po/rw.po (+3088/-0) po/si.po (+2502/-0) po/sk.po (+2404/-0) po/sl.po (+2219/-0) po/sq.po (+2772/-0) po/sr.po (+3370/-0) po/sr@latin.po (+3370/-0) po/sv.po (+2348/-0) po/ta.po (+2643/-0) po/te.po (+2620/-0) po/th.po (+3247/-0) po/tr.po (+2489/-0) po/ug.po (+2678/-0) po/uk.po (+2601/-0) po/vi.po (+1957/-0) po/wa.po (+2806/-0) po/xh.po (+2850/-0) po/zh_CN.po (+2553/-0) po/zh_HK.po (+2664/-0) po/zh_TW.po (+2800/-0) src/Makefile.am (+205/-0) src/Makefile.in (+1470/-0) src/eggdesktopfile.c (+1510/-0) src/eggdesktopfile.h (+160/-0) src/eggshell.c (+114/-0) src/eggshell.h (+40/-0) src/eggsmclient-osx.c (+235/-0) src/eggsmclient-private.h (+53/-0) src/eggsmclient-win32.c (+353/-0) src/eggsmclient-xsmp.c (+1405/-0) src/eggsmclient.c (+610/-0) src/eggsmclient.h (+123/-0) src/encodings-dialog.glade (+296/-0) src/extra-strings.c (+73/-0) src/find-dialog.glade (+236/-0) src/gnome-terminal.schemas.in (+1334/-0) src/keybinding-editor.glade (+194/-0) src/profile-editor.c (+937/-0) src/profile-editor.h (+34/-0) src/profile-manager.glade (+213/-0) src/profile-new-dialog.glade (+261/-0) src/profile-preferences.glade (+2854/-0) src/skey-challenge.glade (+198/-0) src/skey-popup.c (+228/-0) src/skey-popup.h (+35/-0) src/skey/Makefile.am (+60/-0) src/skey/Makefile.in (+773/-0) src/skey/btoe.c (+304/-0) src/skey/btoe.h (+2/-0) src/skey/md4.c (+335/-0) src/skey/md4.h (+19/-0) src/skey/md5.c (+67/-0) src/skey/md5.h (+9/-0) src/skey/sha1.c (+112/-0) src/skey/sha1.h (+9/-0) src/skey/skey.c (+37/-0) src/skey/skey.h (+10/-0) src/skey/skeyutil.c (+24/-0) src/skey/skeyutil.h (+3/-0) src/skey/test.c (+99/-0) src/terminal-accels.c (+1012/-0) src/terminal-accels.h (+35/-0) src/terminal-app.c (+2116/-0) src/terminal-app.h (+159/-0) src/terminal-debug.c (+45/-0) src/terminal-debug.h (+74/-0) src/terminal-encoding.c (+614/-0) src/terminal-encoding.h (+61/-0) src/terminal-info-bar.c (+119/-0) src/terminal-info-bar.h (+62/-0) src/terminal-intl.h (+27/-0) src/terminal-marshal.list (+1/-0) src/terminal-options.c (+1396/-0) src/terminal-options.h (+118/-0) src/terminal-profile.c (+1697/-0) src/terminal-profile.h (+193/-0) src/terminal-screen-container.c (+409/-0) src/terminal-screen-container.h (+69/-0) src/terminal-screen.c (+2378/-0) src/terminal-screen.h (+160/-0) src/terminal-search-dialog.c (+378/-0) src/terminal-search-dialog.h (+49/-0) src/terminal-tab-label.c (+289/-0) src/terminal-tab-label.h (+64/-0) src/terminal-tabs-menu.c (+487/-0) src/terminal-tabs-menu.h (+56/-0) src/terminal-type-builtins.c.template (+45/-0) src/terminal-type-builtins.h.template (+25/-0) src/terminal-util.c (+1213/-0) src/terminal-util.h (+117/-0) src/terminal-version.h (+35/-0) src/terminal-version.h.in (+35/-0) src/terminal-window.c (+4047/-0) src/terminal-window.h (+106/-0) src/terminal.about (+5/-0) src/terminal.c (+619/-0) src/terminal.xml (+118/-0) xmldocs.make (+101/-0) Conflict adding file COPYING. Moved existing file to COPYING.moved. Conflict adding file debian. Moved existing file to debian.moved. |
To merge this branch: | bzr merge lp:~tualatrix/ibentu/gnome-terminal |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ding Zhou | Pending | ||
Review via email: mp+62622@code.launchpad.net |
Commit message
Description of the change
Unmerged revisions
- 76. By Ding Zhou
-
Release gnome-terminal 2.32.0-0ubuntu2
- 75. By Ding Zhou
-
Add Search selection on Google support
- 74. By Chris Coulson
-
* New upstream version 2.32.0
* Drop 21_dont_crash_on_ composite_ change. patch - merged upstream - 73. By Chris Coulson
-
* Fix LP: #633303 - gnome-terminal crashed with signal 5 in _XError()
when Mutter is restarted. Make sure gnome-terminal sets _NET_WM_DESKTOP
on the new X window, rather than the one that was destroyed previously
- add debian/patches/ 21_dont_ crash_on_ composite_ change. patch
- update debian/patches/ series - 72. By Robert Ancell
-
* New upstream release
* debian/control:
- Bump build-depend on libvte-dev - 71. By Robert Ancell
-
* New upstream release
* debian/control:
- Build-depend on dh-autoreconf
- Bump build-depend on libglib2.0-dev, libgtk2.0-dev, libvte-dev,
libgconf2-dev
* debian/rules:
- Use autoreconf.mk - 70. By Chris Coulson
-
* Fix LP: #549552 - solid colour BG is transparent. When set to solid,
the terminal window inherits transparency from the GTK theme. Add
a checkbutton in the Background tab of the preferences to inherit
background settings from the theme to make it possible to choose
a solid colour again (without having to select "Transparent" and
then adjusting the slider to maximum)
- update debian/patches/ 02_add_ transparency_ properties. patch - 69. By Robert Ancell
-
* Merge with Debian unstable, remaining Ubuntu changes:
* debian/control.in:
- Build depend on gnome-common for autotools
- Build depend on liblaunchpad-integration- dev
- Add Bzr link
- Update replaces version on gnome-terminal-data
* debian/rules:
- Run autotools on build
* debian/patches/ 01_lpi. patch:
- Launchpad integration
* debian/patches/ 02_add_ transparency_ properties. patch:
- This patch allows the background transparency to be controlled from
the GTK theme (using "TerminalScreen::background- darkness" ). In
addition to this, the background colour and text colour are already
themable from the GTK theme (by setting the "text[NORMAL]" and
"base[NORMAL]" colours for the TerminalScreen class)
* debian/patches/ 20_add_ alt_screen_ toggle_ ui.patch:
- Hook new vte alternate screen scrolling toggle via UI
* debian/watch:
- Watch for unstable versions - 68. By Robert Ancell
-
* Merge with Debian unstable, remaining Ubuntu changes:
* debian/control.in:
- Build depend on liblaunchpad-integration- dev
- Build depend on gnome-common to run autoreconf
- Add Bzr link
* debian/rules:
- Run autoreconf on build
* debian/patches/ 01_lpi. patch:
- LP integration
* debian/patches/ 02_add_ transparency_ properties. patch:
- This patch allows the background transparency to be controlled from
the GTK theme (using "TerminalScreen::background- darkness" ). In
addition to this, the background colour and text colour are already
themable from the GTK theme (by setting the "text[NORMAL]" and
"base[NORMAL]" colours for the TerminalScreen class)
* debian/patches/ 20_add_ alt_screen_ toggle_ ui.patch:
- Hook new vte alternate screen scrolling toggle via UI
* debian/watch:
- Watch for unstable versions - 67. By Chris Coulson
-
* Revert the previous changes to add a new profile, as changing
the default profile on upgrade is suboptimal, and there are better
ways to implement the visual changes
- Removed patches:
+ 02_rename_default_ profile. patch
+ 03_add_new_profiles_ on_upgrade. patch
+ 04_change_fallback_ profile. patch
- Delete debian/gnome-terminal- ambiance. schemas
- Delete ebian/gnome-termina- data.gconf- defaults
- debian/rules:
+ Don't install custom schema
* Add debian/patches/ 02_add_ transparency_ properties. patch:
- This patch allows the background transparency to be controlled from
the GTK theme (using "TerminalScreen::background- darkness" ). In
addition to this, the background colour and text colour are already
themable from the GTK theme (by setting the "text[NORMAL]" and
"base[NORMAL]" colours for the TerminalScreen class)
* debian/gnome-terminal- data.postinst:
- Fix up the system gconf defaults when upgrading from a previous
unstable version which had the extra profile. Users upgrading from
this will probably still need to remove the "Ambiance" profile
manually from their configuration though (there's not an easy way
to do this automatically, and it only affects users upgrading
from previous unstable versions)
* This fixes LP: #532511 and LP: #542144
Preview Diff
1 | === added directory '.pc' |
2 | === added file '.pc/.version' |
3 | --- .pc/.version 1970-01-01 00:00:00 +0000 |
4 | +++ .pc/.version 2011-05-27 08:11:08 +0000 |
5 | @@ -0,0 +1,1 @@ |
6 | +2 |
7 | |
8 | === added directory '.pc/01_lpi.patch' |
9 | === added file '.pc/01_lpi.patch/configure.ac' |
10 | --- .pc/01_lpi.patch/configure.ac 1970-01-01 00:00:00 +0000 |
11 | +++ .pc/01_lpi.patch/configure.ac 2011-05-27 08:11:08 +0000 |
12 | @@ -0,0 +1,195 @@ |
13 | +m4_define([gt_version_major],[2]) |
14 | +m4_define([gt_version_minor],[32]) |
15 | +m4_define([gt_version_micro],[0]) |
16 | +m4_define([gt_version_extra],[]) |
17 | +m4_define([gt_version],[gt_version_major().gt_version_minor().gt_version_micro()gt_version_extra]) |
18 | + |
19 | +m4_define([gt_api_version],[0]) |
20 | + |
21 | +AC_INIT([GNOME Terminal],[gt_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-terminal],[gnome-terminal]) |
22 | +AC_CONFIG_SRCDIR([src/terminal.c]) |
23 | +AC_CONFIG_HEADERS([config.h]) |
24 | + |
25 | +AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2]) |
26 | + |
27 | +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([no])]) |
28 | + |
29 | +GETTEXT_PACKAGE=gnome-terminal |
30 | +AC_SUBST([GETTEXT_PACKAGE]) |
31 | +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) |
32 | + |
33 | +AC_C_BIGENDIAN |
34 | + |
35 | +if test -z "$enable_maintainer_mode"; then |
36 | + enable_maintainer_mode=yes |
37 | +fi |
38 | +AM_MAINTAINER_MODE([enable]) |
39 | + |
40 | +PKG_PROG_PKG_CONFIG |
41 | +AC_PROG_CC |
42 | +AC_ISC_POSIX |
43 | +AC_HEADER_STDC |
44 | +AM_PROG_LIBTOOL |
45 | +IT_PROG_INTLTOOL([0.40.0]) |
46 | + |
47 | +GNOME_COMMON_INIT |
48 | +GNOME_DEBUG_CHECK |
49 | +GNOME_COMPILE_WARNINGS([maximum]) |
50 | +#GNOME_MAINTAINER_MODE_DEFINES |
51 | + |
52 | +AM_GLIB_GNU_GETTEXT |
53 | + |
54 | +GLIB_REQUIRED=2.25.0 |
55 | +GIO_REQUIRED=2.25.12 |
56 | +GTK_REQUIRED=2.14.0 |
57 | +GCONF_REQUIRED=2.31.3 |
58 | +VTE_REQUIRED=0.25.91 |
59 | + |
60 | +AC_MSG_CHECKING([which gtk+ version to compile against]) |
61 | +AC_ARG_WITH([gtk], |
62 | + [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], |
63 | + [case "$with_gtk" in |
64 | + 2.0|3.0) ;; |
65 | + *) AC_MSG_ERROR([invalid gtk version specified]) ;; |
66 | + esac], |
67 | + [with_gtk=2.0]) |
68 | +AC_MSG_RESULT([$with_gtk]) |
69 | + |
70 | +case "$with_gtk" in |
71 | + 2.0) GTK_API_VERSION=2.0 |
72 | + GTK_REQUIRED=2.18.0 |
73 | + VTE_PC_VERSION= |
74 | + ;; |
75 | + 3.0) GTK_API_VERSION=3.0 |
76 | + GTK_REQUIRED=2.90.6 |
77 | + VTE_PC_VERSION=-2.90 |
78 | + ;; |
79 | +esac |
80 | + |
81 | +GDK_TARGET="$($PKG_CONFIG --variable target gdk-$GTK_API_VERSION)" |
82 | + |
83 | +case "$GDK_TARGET" in |
84 | + x11) PLATFORM_DEPS="x11" ;; |
85 | + *) PLATFORM_DEPS="" ;; |
86 | +esac |
87 | + |
88 | +PKG_CHECK_MODULES([TERM], |
89 | + [vte$VTE_PC_VERSION >= $VTE_REQUIRED |
90 | + glib-2.0 >= $GLIB_REQUIRED |
91 | + gthread-2.0 |
92 | + gio-2.0 >= $GIO_REQUIRED |
93 | + gtk+-$GTK_API_VERSION >= $GTK_REQUIRED |
94 | + gconf-2.0 >= $GCONF_REQUIRED |
95 | + $PLATFORM_DEPS]) |
96 | + |
97 | +# ******** |
98 | +# smclient |
99 | +# ******** |
100 | + |
101 | +SMCLIENT_PKGS= |
102 | +AC_MSG_CHECKING([which smclient backend to use]) |
103 | +AC_ARG_WITH([smclient], |
104 | + [AS_HELP_STRING([--with-smclient-backend],[which smclient backend to use (xsmp/win32/quartz)])], |
105 | + [], |
106 | + [case "$GDK_TARGET" in |
107 | + x11) with_smclient=xsmp SMCLIENT_PKGS="sm" ;; |
108 | + win32|quartz) with_smclient=$GDK_TARGET ;; |
109 | + *) with_smclient=no ;; |
110 | + esac]) |
111 | +AC_MSG_RESULT([$with_smclient]) |
112 | + |
113 | +if test "$with_smclient" != "no"; then |
114 | + AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled]) |
115 | +fi |
116 | + |
117 | +if test -n "$SMCLIENT_PKGS"; then |
118 | + PKG_CHECK_MODULES([SMCLIENT],[$SMCLIENT_PKGS]) |
119 | + AC_SUBST([SMCLIENT_CFLAGS]) |
120 | + AC_SUBST([SMCLIENT_LIBS]) |
121 | +fi |
122 | + |
123 | +AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"]) |
124 | +AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"]) |
125 | +AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"]) |
126 | +AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"]) |
127 | + |
128 | +# ***** |
129 | +# GConf |
130 | +# ***** |
131 | + |
132 | +AC_PATH_PROG(GCONFTOOL, gconftool-2, no) |
133 | + |
134 | +if test x"$GCONFTOOL" = xno; then |
135 | + AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf]) |
136 | +fi |
137 | + |
138 | +AM_GCONF_SOURCE_2 |
139 | + |
140 | +GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)" |
141 | +AC_SUBST([GLIB_GENMARSHAL]) |
142 | +GLIB_MKENUMS="$($PKG_CONFIG --variable=glib_mkenums glib-2.0)" |
143 | +AC_SUBST([GLIB_MKENUMS]) |
144 | + |
145 | +AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false]) |
146 | +if test "$GTK_BUILDER_CONVERT" = "false"; then |
147 | + AC_MSG_ERROR([gtk-builder-convert not found]) |
148 | +fi |
149 | + |
150 | +# ***** |
151 | +# S/Key |
152 | +# ***** |
153 | + |
154 | +AC_MSG_CHECKING([whether to enable s/key support]) |
155 | +AC_ARG_ENABLE([skey], |
156 | + [AS_HELP_STRING([--disable-skey],[disable s/key support (default: enabled)])], |
157 | + [],[enable_skey=yes]) |
158 | +AC_MSG_RESULT([$enable_skey]) |
159 | + |
160 | +if test "$enable_skey" = "yes"; then |
161 | + AC_DEFINE([ENABLE_SKEY],[1],[Define if s/key support is enabled]) |
162 | +fi |
163 | + |
164 | +AM_CONDITIONAL([ENABLE_SKEY],[test "$enable_skey" = "yes"]) |
165 | + |
166 | +# ************* |
167 | +# Documentation |
168 | +# ************* |
169 | + |
170 | +GNOME_DOC_INIT |
171 | + |
172 | +# **************************** |
173 | + |
174 | +AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major]) |
175 | +AC_SUBST([TERMINAL_MINOR_VERSION],[gt_version_minor]) |
176 | +AC_SUBST([TERMINAL_MICRO_VERSION],[gt_version_micro]) |
177 | +AC_SUBST([TERMINAL_API_VERSION],[gt_api_version]) |
178 | + |
179 | +# **************************** |
180 | + |
181 | +AC_CONFIG_FILES([ |
182 | +Makefile |
183 | +gnome-terminal.desktop.in |
184 | +src/Makefile |
185 | +src/terminal-version.h |
186 | +src/skey/Makefile |
187 | +help/Makefile |
188 | +help/bg/Makefile |
189 | +help/ro/Makefile |
190 | +help/ja/Makefile |
191 | +help/zh_TW/Makefile |
192 | +po/Makefile.in |
193 | +]) |
194 | +AC_OUTPUT |
195 | + |
196 | +# **************************** |
197 | + |
198 | +echo " |
199 | +gnome-terminal-$VERSION: |
200 | + |
201 | + prefix: ${prefix} |
202 | + source code location: ${srcdir} |
203 | + compiler: ${CC} |
204 | + |
205 | + using smclient: ${with_smclient} |
206 | + s/key support: ${enable_skey} |
207 | +" |
208 | |
209 | === added directory '.pc/01_lpi.patch/src' |
210 | === added file '.pc/01_lpi.patch/src/terminal-window.c' |
211 | --- .pc/01_lpi.patch/src/terminal-window.c 1970-01-01 00:00:00 +0000 |
212 | +++ .pc/01_lpi.patch/src/terminal-window.c 2011-05-27 08:11:08 +0000 |
213 | @@ -0,0 +1,4026 @@ |
214 | +/* |
215 | + * Copyright © 2001 Havoc Pennington |
216 | + * Copyright © 2002 Red Hat, Inc. |
217 | + * Copyright © 2007, 2008, 2009 Christian Persch |
218 | + * |
219 | + * Gnome-terminal is free software; you can redistribute it and/or modify |
220 | + * it under the terms of the GNU General Public License as published by |
221 | + * the Free Software Foundation; either version 3 of the License, or |
222 | + * (at your option) any later version. |
223 | + * |
224 | + * Gnome-terminal is distributed in the hope that it will be useful, |
225 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
226 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
227 | + * GNU General Public License for more details. |
228 | + * |
229 | + * You should have received a copy of the GNU General Public License |
230 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
231 | + */ |
232 | + |
233 | +#include <config.h> |
234 | + |
235 | +#include <string.h> |
236 | +#include <stdlib.h> |
237 | +#include <gtk/gtk.h> |
238 | +#ifdef GDK_WINDOWING_X11 |
239 | +#include <gdk/gdkx.h> |
240 | +#endif |
241 | +#include <gdk/gdkkeysyms.h> |
242 | + |
243 | +#include "terminal-accels.h" |
244 | +#include "terminal-app.h" |
245 | +#include "terminal-debug.h" |
246 | +#include "terminal-encoding.h" |
247 | +#include "terminal-intl.h" |
248 | +#include "terminal-screen-container.h" |
249 | +#include "terminal-search-dialog.h" |
250 | +#include "terminal-tab-label.h" |
251 | +#include "terminal-tabs-menu.h" |
252 | +#include "terminal-util.h" |
253 | +#include "terminal-window.h" |
254 | + |
255 | +#ifdef ENABLE_SKEY |
256 | +#include "skey-popup.h" |
257 | +#endif |
258 | + |
259 | +struct _TerminalWindowPrivate |
260 | +{ |
261 | + GtkActionGroup *action_group; |
262 | + GtkUIManager *ui_manager; |
263 | + guint ui_id; |
264 | + |
265 | + GtkActionGroup *profiles_action_group; |
266 | + guint profiles_ui_id; |
267 | + |
268 | + GtkActionGroup *encodings_action_group; |
269 | + guint encodings_ui_id; |
270 | + |
271 | + TerminalTabsMenu *tabs_menu; |
272 | + |
273 | + TerminalScreenPopupInfo *popup_info; |
274 | + guint remove_popup_info_idle; |
275 | + |
276 | + GtkActionGroup *new_terminal_action_group; |
277 | + guint new_terminal_ui_id; |
278 | + |
279 | + GtkWidget *menubar; |
280 | + GtkWidget *notebook; |
281 | + TerminalScreen *active_screen; |
282 | + int old_char_width; |
283 | + int old_char_height; |
284 | + void *old_geometry_widget; /* only used for pointer value as it may be freed */ |
285 | + |
286 | + GtkWidget *confirm_close_dialog; |
287 | + GtkWidget *search_find_dialog; |
288 | + |
289 | + guint menubar_visible : 1; |
290 | + guint use_default_menubar_visibility : 1; |
291 | + |
292 | + /* Compositing manager integration */ |
293 | + guint have_argb_visual : 1; |
294 | + |
295 | + /* Used to clear stray "demands attention" flashing on our window when we |
296 | + * unmap and map it to switch to an ARGB visual. |
297 | + */ |
298 | + guint clear_demands_attention : 1; |
299 | + |
300 | + guint disposed : 1; |
301 | + guint present_on_insert : 1; |
302 | + |
303 | + /* Workaround until gtk+ bug #535557 is fixed */ |
304 | + guint icon_title_set : 1; |
305 | +}; |
306 | + |
307 | +#define PROFILE_DATA_KEY "GT::Profile" |
308 | + |
309 | +#define FILE_NEW_TERMINAL_TAB_UI_PATH "/menubar/File/FileNewTabProfiles" |
310 | +#define FILE_NEW_TERMINAL_WINDOW_UI_PATH "/menubar/File/FileNewWindowProfiles" |
311 | +#define SET_ENCODING_UI_PATH "/menubar/Terminal/TerminalSetEncoding/EncodingsPH" |
312 | +#define SET_ENCODING_ACTION_NAME_PREFIX "TerminalSetEncoding" |
313 | + |
314 | +#define PROFILES_UI_PATH "/menubar/Terminal/TerminalProfiles" |
315 | +#define PROFILES_POPUP_UI_PATH "/Popup/PopupTerminalProfiles/ProfilesPH" |
316 | + |
317 | +#define SIZE_TO_UI_PATH "/menubar/Terminal/TerminalSizeToPH" |
318 | +#define SIZE_TO_ACTION_NAME_PREFIX "TerminalSizeTo" |
319 | + |
320 | +#define STOCK_NEW_WINDOW "window-new" |
321 | +#define STOCK_NEW_TAB "tab-new" |
322 | + |
323 | +#define ENCODING_DATA_KEY "encoding" |
324 | + |
325 | +#if 1 |
326 | +/* |
327 | + * We don't want to enable content saving until vte supports it async. |
328 | + * So we disable this code for stable versions. |
329 | + */ |
330 | +#include "terminal-version.h" |
331 | + |
332 | +#if (TERMINAL_MINOR_VERSION & 1) != 0 |
333 | +#define ENABLE_SAVE |
334 | +#else |
335 | +#undef ENABLE_SAVE |
336 | +#endif |
337 | +#endif |
338 | + |
339 | +static void terminal_window_dispose (GObject *object); |
340 | +static void terminal_window_finalize (GObject *object); |
341 | +static gboolean terminal_window_state_event (GtkWidget *widget, |
342 | + GdkEventWindowState *event); |
343 | + |
344 | +static gboolean terminal_window_delete_event (GtkWidget *widget, |
345 | + GdkEvent *event, |
346 | + gpointer data); |
347 | + |
348 | +static gboolean notebook_button_press_cb (GtkWidget *notebook, |
349 | + GdkEventButton *event, |
350 | + TerminalWindow *window); |
351 | +static gboolean notebook_popup_menu_cb (GtkWidget *notebook, |
352 | + TerminalWindow *window); |
353 | +static void notebook_page_selected_callback (GtkWidget *notebook, |
354 | +#if GTK_CHECK_VERSION (2, 90, 6) |
355 | + GtkWidget *page, |
356 | +#else |
357 | + gpointer page, |
358 | +#endif |
359 | + guint page_num, |
360 | + TerminalWindow *window); |
361 | +static void notebook_page_added_callback (GtkWidget *notebook, |
362 | + GtkWidget *container, |
363 | + guint page_num, |
364 | + TerminalWindow *window); |
365 | +static void notebook_page_removed_callback (GtkWidget *notebook, |
366 | + GtkWidget *container, |
367 | + guint page_num, |
368 | + TerminalWindow *window); |
369 | + |
370 | +/* Menu action callbacks */ |
371 | +static void file_new_window_callback (GtkAction *action, |
372 | + TerminalWindow *window); |
373 | +static void file_new_tab_callback (GtkAction *action, |
374 | + TerminalWindow *window); |
375 | +static void file_new_profile_callback (GtkAction *action, |
376 | + TerminalWindow *window); |
377 | +static void file_close_window_callback (GtkAction *action, |
378 | + TerminalWindow *window); |
379 | +static void file_save_contents_callback (GtkAction *action, |
380 | + TerminalWindow *window); |
381 | +static void file_close_tab_callback (GtkAction *action, |
382 | + TerminalWindow *window); |
383 | +static void edit_copy_callback (GtkAction *action, |
384 | + TerminalWindow *window); |
385 | +static void edit_paste_callback (GtkAction *action, |
386 | + TerminalWindow *window); |
387 | +static void edit_select_all_callback (GtkAction *action, |
388 | + TerminalWindow *window); |
389 | +static void edit_keybindings_callback (GtkAction *action, |
390 | + TerminalWindow *window); |
391 | +static void edit_profiles_callback (GtkAction *action, |
392 | + TerminalWindow *window); |
393 | +static void edit_current_profile_callback (GtkAction *action, |
394 | + TerminalWindow *window); |
395 | +static void view_menubar_toggled_callback (GtkToggleAction *action, |
396 | + TerminalWindow *window); |
397 | +static void view_fullscreen_toggled_callback (GtkToggleAction *action, |
398 | + TerminalWindow *window); |
399 | +static void view_zoom_in_callback (GtkAction *action, |
400 | + TerminalWindow *window); |
401 | +static void view_zoom_out_callback (GtkAction *action, |
402 | + TerminalWindow *window); |
403 | +static void view_zoom_normal_callback (GtkAction *action, |
404 | + TerminalWindow *window); |
405 | +static void search_find_callback (GtkAction *action, |
406 | + TerminalWindow *window); |
407 | +static void search_find_next_callback (GtkAction *action, |
408 | + TerminalWindow *window); |
409 | +static void search_find_prev_callback (GtkAction *action, |
410 | + TerminalWindow *window); |
411 | +static void search_clear_highlight_callback (GtkAction *action, |
412 | + TerminalWindow *window); |
413 | +static void terminal_set_title_callback (GtkAction *action, |
414 | + TerminalWindow *window); |
415 | +static void terminal_add_encoding_callback (GtkAction *action, |
416 | + TerminalWindow *window); |
417 | +static void terminal_reset_callback (GtkAction *action, |
418 | + TerminalWindow *window); |
419 | +static void terminal_reset_clear_callback (GtkAction *action, |
420 | + TerminalWindow *window); |
421 | +static void tabs_next_or_previous_tab_cb (GtkAction *action, |
422 | + TerminalWindow *window); |
423 | +static void tabs_move_left_callback (GtkAction *action, |
424 | + TerminalWindow *window); |
425 | +static void tabs_move_right_callback (GtkAction *action, |
426 | + TerminalWindow *window); |
427 | +static void tabs_detach_tab_callback (GtkAction *action, |
428 | + TerminalWindow *window); |
429 | +static void help_contents_callback (GtkAction *action, |
430 | + TerminalWindow *window); |
431 | +static void help_about_callback (GtkAction *action, |
432 | + TerminalWindow *window); |
433 | + |
434 | +static gboolean find_larger_zoom_factor (double current, |
435 | + double *found); |
436 | +static gboolean find_smaller_zoom_factor (double current, |
437 | + double *found); |
438 | + |
439 | +static void terminal_window_show (GtkWidget *widget); |
440 | + |
441 | +static gboolean confirm_close_window_or_tab (TerminalWindow *window, |
442 | + TerminalScreen *screen); |
443 | + |
444 | +static void |
445 | +profile_set_callback (TerminalScreen *screen, |
446 | + TerminalProfile *old_profile, |
447 | + TerminalWindow *window); |
448 | +static void |
449 | +sync_screen_icon_title (TerminalScreen *screen, |
450 | + GParamSpec *psepc, |
451 | + TerminalWindow *window); |
452 | + |
453 | +G_DEFINE_TYPE (TerminalWindow, terminal_window, GTK_TYPE_WINDOW) |
454 | + |
455 | +/* Menubar mnemonics & accel settings handling */ |
456 | + |
457 | +static void |
458 | +app_setting_notify_cb (TerminalApp *app, |
459 | + GParamSpec *pspec, |
460 | + GdkScreen *screen) |
461 | +{ |
462 | + GtkSettings *settings; |
463 | + const char *prop_name; |
464 | + |
465 | + if (pspec) |
466 | + prop_name = pspec->name; |
467 | + else |
468 | + prop_name = NULL; |
469 | + |
470 | + settings = gtk_settings_get_for_screen (screen); |
471 | + |
472 | + if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MNEMONICS)) |
473 | + { |
474 | + gboolean enable_mnemonics; |
475 | + |
476 | + g_object_get (app, TERMINAL_APP_ENABLE_MNEMONICS, &enable_mnemonics, NULL); |
477 | + g_object_set (settings, "gtk-enable-mnemonics", enable_mnemonics, NULL); |
478 | + } |
479 | + |
480 | + if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MENU_BAR_ACCEL)) |
481 | + { |
482 | + /* const */ char *saved_menubar_accel; |
483 | + gboolean enable_menubar_accel; |
484 | + |
485 | + /* FIXME: Once gtk+ bug 507398 is fixed, use that to reset the property instead */ |
486 | + /* Now this is a bad hack on so many levels. */ |
487 | + saved_menubar_accel = g_object_get_data (G_OBJECT (settings), "GT::gtk-menu-bar-accel"); |
488 | + if (!saved_menubar_accel) |
489 | + { |
490 | + g_object_get (settings, "gtk-menu-bar-accel", &saved_menubar_accel, NULL); |
491 | + g_object_set_data_full (G_OBJECT (settings), "GT::gtk-menu-bar-accel", |
492 | + saved_menubar_accel, (GDestroyNotify) g_free); |
493 | + } |
494 | + |
495 | + g_object_get (app, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, &enable_menubar_accel, NULL); |
496 | + if (enable_menubar_accel) |
497 | + g_object_set (settings, "gtk-menu-bar-accel", saved_menubar_accel, NULL); |
498 | + else |
499 | + g_object_set (settings, "gtk-menu-bar-accel", NULL, NULL); |
500 | + } |
501 | +} |
502 | + |
503 | +static void |
504 | +app_setting_notify_destroy_cb (GdkScreen *screen) |
505 | +{ |
506 | + g_signal_handlers_disconnect_by_func (terminal_app_get (), |
507 | + G_CALLBACK (app_setting_notify_cb), |
508 | + screen); |
509 | +} |
510 | + |
511 | +/* utility functions */ |
512 | + |
513 | +static char * |
514 | +escape_underscores (const char *name) |
515 | +{ |
516 | + GString *escaped_name; |
517 | + |
518 | + g_assert (name != NULL); |
519 | + |
520 | + /* Who'd use more that 4 underscores in a profile name... */ |
521 | + escaped_name = g_string_sized_new (strlen (name) + 4 + 1); |
522 | + |
523 | + while (*name) |
524 | + { |
525 | + if (*name == '_') |
526 | + g_string_append (escaped_name, "__"); |
527 | + else |
528 | + g_string_append_c (escaped_name, *name); |
529 | + name++; |
530 | + } |
531 | + |
532 | + return g_string_free (escaped_name, FALSE); |
533 | +} |
534 | + |
535 | +static int |
536 | +find_tab_num_at_pos (GtkNotebook *notebook, |
537 | + int screen_x, |
538 | + int screen_y) |
539 | +{ |
540 | + GtkPositionType tab_pos; |
541 | + int page_num = 0; |
542 | + GtkNotebook *nb = GTK_NOTEBOOK (notebook); |
543 | + GtkWidget *page; |
544 | + GtkAllocation tab_allocation; |
545 | + |
546 | + tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook)); |
547 | + |
548 | + while ((page = gtk_notebook_get_nth_page (nb, page_num))) |
549 | + { |
550 | + GtkWidget *tab; |
551 | + int max_x, max_y, x_root, y_root; |
552 | + |
553 | + tab = gtk_notebook_get_tab_label (nb, page); |
554 | + g_return_val_if_fail (tab != NULL, -1); |
555 | + |
556 | + if (!gtk_widget_get_mapped (GTK_WIDGET (tab))) |
557 | + { |
558 | + page_num++; |
559 | + continue; |
560 | + } |
561 | + |
562 | + gdk_window_get_origin (gtk_widget_get_window (tab), &x_root, &y_root); |
563 | + |
564 | + gtk_widget_get_allocation (tab, &tab_allocation); |
565 | + max_x = x_root + tab_allocation.x + tab_allocation.width; |
566 | + max_y = y_root + tab_allocation.y + tab_allocation.height; |
567 | + |
568 | + if ((tab_pos == GTK_POS_TOP || tab_pos == GTK_POS_BOTTOM) && screen_x <= max_x) |
569 | + return page_num; |
570 | + |
571 | + if ((tab_pos == GTK_POS_LEFT || tab_pos == GTK_POS_RIGHT) && screen_y <= max_y) |
572 | + return page_num; |
573 | + |
574 | + page_num++; |
575 | + } |
576 | + |
577 | + return -1; |
578 | +} |
579 | + |
580 | +static void |
581 | +position_menu_under_widget (GtkMenu *menu, |
582 | + int *x, |
583 | + int *y, |
584 | + gboolean *push_in, |
585 | + gpointer user_data) |
586 | +{ |
587 | + /* Adapted from gtktoolbar.c */ |
588 | + GtkWidget *widget = GTK_WIDGET (user_data); |
589 | + GdkWindow *widget_window; |
590 | + GtkWidget *container; |
591 | + GtkRequisition req; |
592 | + GtkRequisition menu_req; |
593 | + GdkRectangle monitor; |
594 | + int monitor_num; |
595 | + GdkScreen *screen; |
596 | + GtkAllocation widget_allocation; |
597 | + |
598 | + widget_window = gtk_widget_get_window (widget); |
599 | + gtk_widget_get_allocation (widget, &widget_allocation); |
600 | + container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER); |
601 | + |
602 | + gtk_widget_size_request (widget, &req); |
603 | + gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); |
604 | + |
605 | + screen = gtk_widget_get_screen (GTK_WIDGET (menu)); |
606 | + monitor_num = gdk_screen_get_monitor_at_window (screen, widget_window); |
607 | + if (monitor_num < 0) |
608 | + monitor_num = 0; |
609 | + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
610 | + |
611 | + gdk_window_get_origin (widget_window, x, y); |
612 | + if (!gtk_widget_get_has_window (widget)) |
613 | + { |
614 | + *x += widget_allocation.x; |
615 | + *y += widget_allocation.y; |
616 | + } |
617 | + if (gtk_widget_get_direction (container) == GTK_TEXT_DIR_LTR) |
618 | + *x += widget_allocation.width - req.width; |
619 | + else |
620 | + *x += req.width - menu_req.width; |
621 | + |
622 | + if ((*y + widget_allocation.height + menu_req.height) <= monitor.y + monitor.height) |
623 | + *y += widget_allocation.height; |
624 | + else if ((*y - menu_req.height) >= monitor.y) |
625 | + *y -= menu_req.height; |
626 | + else if (monitor.y + monitor.height - (*y + widget_allocation.height) > *y) |
627 | + *y += widget_allocation.height; |
628 | + else |
629 | + *y -= menu_req.height; |
630 | + |
631 | + *push_in = FALSE; |
632 | +} |
633 | + |
634 | +static void |
635 | +terminal_set_profile_toggled_callback (GtkToggleAction *action, |
636 | + TerminalWindow *window) |
637 | +{ |
638 | + TerminalWindowPrivate *priv = window->priv; |
639 | + TerminalProfile *profile; |
640 | + |
641 | + if (!gtk_toggle_action_get_active (action)) |
642 | + return; |
643 | + |
644 | + if (priv->active_screen == NULL) |
645 | + return; |
646 | + |
647 | + profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY); |
648 | + g_assert (profile); |
649 | + |
650 | + if (_terminal_profile_get_forgotten (profile)) |
651 | + return; |
652 | + |
653 | + g_signal_handlers_block_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window); |
654 | + terminal_screen_set_profile (priv->active_screen, profile); |
655 | + g_signal_handlers_unblock_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window); |
656 | +} |
657 | + |
658 | +static void |
659 | +profile_visible_name_notify_cb (TerminalProfile *profile, |
660 | + GParamSpec *pspec, |
661 | + GtkAction *action) |
662 | +{ |
663 | + const char *visible_name; |
664 | + char *dot, *display_name; |
665 | + guint num; |
666 | + |
667 | + visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME); |
668 | + display_name = escape_underscores (visible_name); |
669 | + |
670 | + dot = strchr (gtk_action_get_name (action), '.'); |
671 | + if (dot != NULL) |
672 | + { |
673 | + char *free_me; |
674 | + |
675 | + num = g_ascii_strtoll (dot + 1, NULL, 10); |
676 | + |
677 | + free_me = display_name; |
678 | + if (num < 10) |
679 | + /* Translators: This is the label of a menu item to choose a profile. |
680 | + * _%d is used as the accelerator (with d between 1 and 9), and |
681 | + * the %s is the name of the terminal profile. |
682 | + */ |
683 | + display_name = g_strdup_printf (_("_%d. %s"), num, display_name); |
684 | + else if (num < 36) |
685 | + /* Translators: This is the label of a menu item to choose a profile. |
686 | + * _%c is used as the accelerator (it will be a character between A and Z), |
687 | + * and the %s is the name of the terminal profile. |
688 | + */ |
689 | + display_name = g_strdup_printf (_("_%c. %s"), ('A' + num - 10), display_name); |
690 | + else |
691 | + free_me = NULL; |
692 | + |
693 | + g_free (free_me); |
694 | + } |
695 | + |
696 | + g_object_set (action, "label", display_name, NULL); |
697 | + g_free (display_name); |
698 | +} |
699 | + |
700 | +static void |
701 | +disconnect_profiles_from_actions_in_group (GtkActionGroup *action_group) |
702 | +{ |
703 | + GList *actions, *l; |
704 | + |
705 | + actions = gtk_action_group_list_actions (action_group); |
706 | + for (l = actions; l != NULL; l = l->next) |
707 | + { |
708 | + GObject *action = G_OBJECT (l->data); |
709 | + TerminalProfile *profile; |
710 | + |
711 | + profile = g_object_get_data (action, PROFILE_DATA_KEY); |
712 | + if (!profile) |
713 | + continue; |
714 | + |
715 | + g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_visible_name_notify_cb), action); |
716 | + } |
717 | + g_list_free (actions); |
718 | +} |
719 | + |
720 | +static void |
721 | +terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window) |
722 | +{ |
723 | + TerminalWindowPrivate *priv = window->priv; |
724 | + TerminalProfile *new_active_profile; |
725 | + GList *actions, *l; |
726 | + |
727 | + if (!priv->profiles_action_group) |
728 | + return; |
729 | + |
730 | + if (!priv->active_screen) |
731 | + return; |
732 | + |
733 | + new_active_profile = terminal_screen_get_profile (priv->active_screen); |
734 | + |
735 | + actions = gtk_action_group_list_actions (priv->profiles_action_group); |
736 | + for (l = actions; l != NULL; l = l->next) |
737 | + { |
738 | + GObject *action = G_OBJECT (l->data); |
739 | + TerminalProfile *profile; |
740 | + |
741 | + profile = g_object_get_data (action, PROFILE_DATA_KEY); |
742 | + if (profile != new_active_profile) |
743 | + continue; |
744 | + |
745 | + g_signal_handlers_block_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window); |
746 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); |
747 | + g_signal_handlers_unblock_by_func (action, G_CALLBACK (terminal_set_profile_toggled_callback), window); |
748 | + |
749 | + break; |
750 | + } |
751 | + g_list_free (actions); |
752 | +} |
753 | + |
754 | +static void |
755 | +terminal_window_update_set_profile_menu (TerminalWindow *window) |
756 | +{ |
757 | + TerminalWindowPrivate *priv = window->priv; |
758 | + TerminalProfile *active_profile; |
759 | + GtkActionGroup *action_group; |
760 | + GtkAction *action; |
761 | + GList *profiles, *p; |
762 | + GSList *group; |
763 | + guint n; |
764 | + gboolean single_profile; |
765 | + |
766 | + /* Remove the old UI */ |
767 | + if (priv->profiles_ui_id != 0) |
768 | + { |
769 | + gtk_ui_manager_remove_ui (priv->ui_manager, priv->profiles_ui_id); |
770 | + priv->profiles_ui_id = 0; |
771 | + } |
772 | + |
773 | + if (priv->profiles_action_group != NULL) |
774 | + { |
775 | + disconnect_profiles_from_actions_in_group (priv->profiles_action_group); |
776 | + gtk_ui_manager_remove_action_group (priv->ui_manager, |
777 | + priv->profiles_action_group); |
778 | + priv->profiles_action_group = NULL; |
779 | + } |
780 | + |
781 | + profiles = terminal_app_get_profile_list (terminal_app_get ()); |
782 | + |
783 | + action = gtk_action_group_get_action (priv->action_group, "TerminalProfiles"); |
784 | + single_profile = !profiles || profiles->next == NULL; /* list length <= 1 */ |
785 | + gtk_action_set_sensitive (action, !single_profile); |
786 | + if (profiles == NULL) |
787 | + return; |
788 | + |
789 | + if (priv->active_screen) |
790 | + active_profile = terminal_screen_get_profile (priv->active_screen); |
791 | + else |
792 | + active_profile = NULL; |
793 | + |
794 | + action_group = priv->profiles_action_group = gtk_action_group_new ("Profiles"); |
795 | + gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1); |
796 | + g_object_unref (action_group); |
797 | + |
798 | + priv->profiles_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager); |
799 | + |
800 | + group = NULL; |
801 | + n = 0; |
802 | + for (p = profiles; p != NULL; p = p->next) |
803 | + { |
804 | + TerminalProfile *profile = (TerminalProfile *) p->data; |
805 | + GtkRadioAction *profile_action; |
806 | + char name[32]; |
807 | + |
808 | + g_snprintf (name, sizeof (name), "TerminalSetProfile%u", n++); |
809 | + |
810 | + profile_action = gtk_radio_action_new (name, |
811 | + NULL, |
812 | + NULL, |
813 | + NULL, |
814 | + n); |
815 | + |
816 | + gtk_radio_action_set_group (profile_action, group); |
817 | + group = gtk_radio_action_get_group (profile_action); |
818 | + |
819 | + if (profile == active_profile) |
820 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (profile_action), TRUE); |
821 | + |
822 | + g_object_set_data_full (G_OBJECT (profile_action), |
823 | + PROFILE_DATA_KEY, |
824 | + g_object_ref (profile), |
825 | + (GDestroyNotify) g_object_unref); |
826 | + profile_visible_name_notify_cb (profile, NULL, GTK_ACTION (profile_action)); |
827 | + g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME, |
828 | + G_CALLBACK (profile_visible_name_notify_cb), profile_action); |
829 | + g_signal_connect (profile_action, "toggled", |
830 | + G_CALLBACK (terminal_set_profile_toggled_callback), window); |
831 | + |
832 | + gtk_action_group_add_action (action_group, GTK_ACTION (profile_action)); |
833 | + g_object_unref (profile_action); |
834 | + |
835 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->profiles_ui_id, |
836 | + PROFILES_UI_PATH, |
837 | + name, name, |
838 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
839 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->profiles_ui_id, |
840 | + PROFILES_POPUP_UI_PATH, |
841 | + name, name, |
842 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
843 | + } |
844 | + |
845 | + g_list_free (profiles); |
846 | +} |
847 | + |
848 | +static void |
849 | +terminal_window_create_new_terminal_action (TerminalWindow *window, |
850 | + TerminalProfile *profile, |
851 | + const char *name, |
852 | + guint num, |
853 | + GCallback callback) |
854 | +{ |
855 | + TerminalWindowPrivate *priv = window->priv; |
856 | + GtkAction *action; |
857 | + |
858 | + action = gtk_action_new (name, NULL, NULL, NULL); |
859 | + |
860 | + g_object_set_data_full (G_OBJECT (action), |
861 | + PROFILE_DATA_KEY, |
862 | + g_object_ref (profile), |
863 | + (GDestroyNotify) g_object_unref); |
864 | + profile_visible_name_notify_cb (profile, NULL, action); |
865 | + g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME, |
866 | + G_CALLBACK (profile_visible_name_notify_cb), action); |
867 | + g_signal_connect (action, "activate", callback, window); |
868 | + |
869 | + gtk_action_group_add_action (priv->new_terminal_action_group, action); |
870 | + g_object_unref (action); |
871 | +} |
872 | + |
873 | +static void |
874 | +terminal_window_update_new_terminal_menus (TerminalWindow *window) |
875 | +{ |
876 | + TerminalWindowPrivate *priv = window->priv; |
877 | + GtkActionGroup *action_group; |
878 | + GtkAction *action; |
879 | + GList *profiles, *p; |
880 | + guint n; |
881 | + gboolean have_single_profile; |
882 | + |
883 | + /* Remove the old UI */ |
884 | + if (priv->new_terminal_ui_id != 0) |
885 | + { |
886 | + gtk_ui_manager_remove_ui (priv->ui_manager, priv->new_terminal_ui_id); |
887 | + priv->new_terminal_ui_id = 0; |
888 | + } |
889 | + |
890 | + if (priv->new_terminal_action_group != NULL) |
891 | + { |
892 | + disconnect_profiles_from_actions_in_group (priv->new_terminal_action_group); |
893 | + gtk_ui_manager_remove_action_group (priv->ui_manager, |
894 | + priv->new_terminal_action_group); |
895 | + priv->new_terminal_action_group = NULL; |
896 | + } |
897 | + |
898 | + profiles = terminal_app_get_profile_list (terminal_app_get ()); |
899 | + have_single_profile = !profiles || !profiles->next; |
900 | + |
901 | + action = gtk_action_group_get_action (priv->action_group, "FileNewTab"); |
902 | + gtk_action_set_visible (action, have_single_profile); |
903 | + action = gtk_action_group_get_action (priv->action_group, "FileNewWindow"); |
904 | + gtk_action_set_visible (action, have_single_profile); |
905 | + |
906 | + if (have_single_profile) |
907 | + { |
908 | + g_list_free (profiles); |
909 | + return; |
910 | + } |
911 | + |
912 | + /* Now build the submenus */ |
913 | + |
914 | + action_group = priv->new_terminal_action_group = gtk_action_group_new ("NewTerminal"); |
915 | + gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1); |
916 | + g_object_unref (action_group); |
917 | + |
918 | + priv->new_terminal_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager); |
919 | + |
920 | + n = 0; |
921 | + for (p = profiles; p != NULL; p = p->next) |
922 | + { |
923 | + TerminalProfile *profile = (TerminalProfile *) p->data; |
924 | + char name[32]; |
925 | + |
926 | + g_snprintf (name, sizeof (name), "FileNewTab.%u", n); |
927 | + terminal_window_create_new_terminal_action (window, |
928 | + profile, |
929 | + name, |
930 | + n, |
931 | + G_CALLBACK (file_new_tab_callback)); |
932 | + |
933 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->new_terminal_ui_id, |
934 | + FILE_NEW_TERMINAL_TAB_UI_PATH, |
935 | + name, name, |
936 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
937 | + |
938 | + g_snprintf (name, sizeof (name), "FileNewWindow.%u", n); |
939 | + terminal_window_create_new_terminal_action (window, |
940 | + profile, |
941 | + name, |
942 | + n, |
943 | + G_CALLBACK (file_new_window_callback)); |
944 | + |
945 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->new_terminal_ui_id, |
946 | + FILE_NEW_TERMINAL_WINDOW_UI_PATH, |
947 | + name, name, |
948 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
949 | + |
950 | + ++n; |
951 | + } |
952 | + |
953 | + g_list_free (profiles); |
954 | +} |
955 | + |
956 | +static void |
957 | +terminal_set_encoding_callback (GtkToggleAction *action, |
958 | + TerminalWindow *window) |
959 | +{ |
960 | + TerminalWindowPrivate *priv = window->priv; |
961 | + TerminalEncoding *encoding; |
962 | + |
963 | + if (!gtk_toggle_action_get_active (action)) |
964 | + return; |
965 | + |
966 | + if (priv->active_screen == NULL) |
967 | + return; |
968 | + |
969 | + encoding = g_object_get_data (G_OBJECT (action), ENCODING_DATA_KEY); |
970 | + g_assert (encoding); |
971 | + |
972 | + vte_terminal_set_encoding (VTE_TERMINAL (priv->active_screen), |
973 | + terminal_encoding_get_charset (encoding)); |
974 | +} |
975 | + |
976 | +static void |
977 | +terminal_window_update_encoding_menu (TerminalWindow *window) |
978 | +{ |
979 | + TerminalWindowPrivate *priv = window->priv; |
980 | + TerminalApp *app; |
981 | + GtkActionGroup *action_group; |
982 | + GSList *group; |
983 | + guint n; |
984 | + GSList *encodings, *l; |
985 | + const char *charset; |
986 | + TerminalEncoding *active_encoding; |
987 | + |
988 | + /* Remove the old UI */ |
989 | + if (priv->encodings_ui_id != 0) |
990 | + { |
991 | + gtk_ui_manager_remove_ui (priv->ui_manager, priv->encodings_ui_id); |
992 | + priv->encodings_ui_id = 0; |
993 | + } |
994 | + |
995 | + if (priv->encodings_action_group != NULL) |
996 | + { |
997 | + gtk_ui_manager_remove_action_group (priv->ui_manager, |
998 | + priv->encodings_action_group); |
999 | + priv->encodings_action_group = NULL; |
1000 | + } |
1001 | + |
1002 | + action_group = priv->encodings_action_group = gtk_action_group_new ("Encodings"); |
1003 | + gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, -1); |
1004 | + g_object_unref (action_group); |
1005 | + |
1006 | + priv->encodings_ui_id = gtk_ui_manager_new_merge_id (priv->ui_manager); |
1007 | + |
1008 | + if (priv->active_screen) |
1009 | + charset = vte_terminal_get_encoding (VTE_TERMINAL (priv->active_screen)); |
1010 | + else |
1011 | + charset = "current"; |
1012 | + |
1013 | + app = terminal_app_get (); |
1014 | + active_encoding = terminal_app_ensure_encoding (app, charset); |
1015 | + |
1016 | + encodings = terminal_app_get_active_encodings (app); |
1017 | + |
1018 | + if (g_slist_find (encodings, active_encoding) == NULL) |
1019 | + encodings = g_slist_append (encodings, terminal_encoding_ref (active_encoding)); |
1020 | + |
1021 | + group = NULL; |
1022 | + n = 0; |
1023 | + for (l = encodings; l != NULL; l = l->next) |
1024 | + { |
1025 | + TerminalEncoding *e = (TerminalEncoding *) l->data; |
1026 | + GtkRadioAction *encoding_action; |
1027 | + char name[128]; |
1028 | + char *display_name; |
1029 | + |
1030 | + g_snprintf (name, sizeof (name), SET_ENCODING_ACTION_NAME_PREFIX "%s", terminal_encoding_get_id (e)); |
1031 | + display_name = g_strdup_printf ("%s (%s)", e->name, terminal_encoding_get_charset (e)); |
1032 | + |
1033 | + encoding_action = gtk_radio_action_new (name, |
1034 | + display_name, |
1035 | + NULL, |
1036 | + NULL, |
1037 | + n); |
1038 | + g_free (display_name); |
1039 | + |
1040 | + gtk_radio_action_set_group (encoding_action, group); |
1041 | + group = gtk_radio_action_get_group (encoding_action); |
1042 | + |
1043 | + if (charset && strcmp (terminal_encoding_get_id (e), charset) == 0) |
1044 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (encoding_action), TRUE); |
1045 | + |
1046 | + g_signal_connect (encoding_action, "toggled", |
1047 | + G_CALLBACK (terminal_set_encoding_callback), window); |
1048 | + |
1049 | + g_object_set_data_full (G_OBJECT (encoding_action), ENCODING_DATA_KEY, |
1050 | + terminal_encoding_ref (e), |
1051 | + (GDestroyNotify) terminal_encoding_unref); |
1052 | + |
1053 | + gtk_action_group_add_action (action_group, GTK_ACTION (encoding_action)); |
1054 | + g_object_unref (encoding_action); |
1055 | + |
1056 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->encodings_ui_id, |
1057 | + SET_ENCODING_UI_PATH, |
1058 | + name, name, |
1059 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
1060 | + } |
1061 | + |
1062 | + g_slist_foreach (encodings, (GFunc) terminal_encoding_unref, NULL); |
1063 | + g_slist_free (encodings); |
1064 | +} |
1065 | + |
1066 | +static void |
1067 | +terminal_window_update_encoding_menu_active_encoding (TerminalWindow *window) |
1068 | +{ |
1069 | + TerminalWindowPrivate *priv = window->priv; |
1070 | + GtkAction *action; |
1071 | + char name[128]; |
1072 | + |
1073 | + if (!priv->active_screen) |
1074 | + return; |
1075 | + if (!priv->encodings_action_group) |
1076 | + return; |
1077 | + |
1078 | + g_snprintf (name, sizeof (name), SET_ENCODING_ACTION_NAME_PREFIX "%s", |
1079 | + vte_terminal_get_encoding (VTE_TERMINAL (priv->active_screen))); |
1080 | + action = gtk_action_group_get_action (priv->encodings_action_group, name); |
1081 | + if (!action) |
1082 | + return; |
1083 | + |
1084 | + g_signal_handlers_block_by_func (action, G_CALLBACK (terminal_set_encoding_callback), window); |
1085 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); |
1086 | + g_signal_handlers_unblock_by_func (action, G_CALLBACK (terminal_set_encoding_callback), window); |
1087 | +} |
1088 | + |
1089 | +static void |
1090 | +terminal_size_to_cb (GtkAction *action, |
1091 | + TerminalWindow *window) |
1092 | +{ |
1093 | + TerminalWindowPrivate *priv = window->priv; |
1094 | + const char *name; |
1095 | + char *end = NULL; |
1096 | + guint width, height; |
1097 | + |
1098 | + if (priv->active_screen == NULL) |
1099 | + return; |
1100 | + |
1101 | + name = gtk_action_get_name (action) + strlen (SIZE_TO_ACTION_NAME_PREFIX); |
1102 | + width = g_ascii_strtoull (name, &end, 10); |
1103 | + g_assert (end && *end == 'x'); |
1104 | + height = g_ascii_strtoull (end + 1, &end, 10); |
1105 | + g_assert (end && *end == '\0'); |
1106 | + |
1107 | + vte_terminal_set_size (VTE_TERMINAL (priv->active_screen), width, height); |
1108 | + |
1109 | + terminal_window_set_size_force_grid (window, priv->active_screen, TRUE, -1, -1); |
1110 | +} |
1111 | + |
1112 | +static void |
1113 | +terminal_window_update_size_to_menu (TerminalWindow *window) |
1114 | +{ |
1115 | + static const struct { |
1116 | + guint grid_width; |
1117 | + guint grid_height; |
1118 | + } predefined_sizes[] = { |
1119 | + { 80, 24 }, |
1120 | + { 80, 43 }, |
1121 | + { 132, 24 }, |
1122 | + { 132, 43 } |
1123 | + }; |
1124 | + TerminalWindowPrivate *priv = window->priv; |
1125 | + guint i; |
1126 | + |
1127 | + /* We only install this once, so there's no need for a separate action group |
1128 | + * and any cleanup + build-new-one action here. |
1129 | + */ |
1130 | + |
1131 | + for (i = 0; i < G_N_ELEMENTS (predefined_sizes); ++i) |
1132 | + { |
1133 | + guint grid_width = predefined_sizes[i].grid_width; |
1134 | + guint grid_height = predefined_sizes[i].grid_height; |
1135 | + GtkAction *action; |
1136 | + char name[40]; |
1137 | + char *display_name; |
1138 | + |
1139 | + g_snprintf (name, sizeof (name), SIZE_TO_ACTION_NAME_PREFIX "%ux%u", |
1140 | + grid_width, grid_height); |
1141 | + |
1142 | + /* If there are ever more than 9 of these, extend this to use A..Z as mnemonics, |
1143 | + * like we do for the profiles menu. |
1144 | + */ |
1145 | + display_name = g_strdup_printf ("_%u. %ux%u", i + 1, grid_width, grid_height); |
1146 | + |
1147 | + action = gtk_action_new (name, display_name, NULL, NULL); |
1148 | + g_free (display_name); |
1149 | + |
1150 | + g_signal_connect (action, "activate", |
1151 | + G_CALLBACK (terminal_size_to_cb), window); |
1152 | + |
1153 | + gtk_action_group_add_action (priv->action_group, action); |
1154 | + g_object_unref (action); |
1155 | + |
1156 | + gtk_ui_manager_add_ui (priv->ui_manager, priv->ui_id, |
1157 | + SIZE_TO_UI_PATH, |
1158 | + name, name, |
1159 | + GTK_UI_MANAGER_MENUITEM, FALSE); |
1160 | + } |
1161 | +} |
1162 | + |
1163 | +/* Actions stuff */ |
1164 | + |
1165 | +static void |
1166 | +terminal_window_update_copy_sensitivity (TerminalScreen *screen, |
1167 | + TerminalWindow *window) |
1168 | +{ |
1169 | + TerminalWindowPrivate *priv = window->priv; |
1170 | + GtkAction *action; |
1171 | + gboolean can_copy; |
1172 | + |
1173 | + if (screen != priv->active_screen) |
1174 | + return; |
1175 | + |
1176 | + can_copy = vte_terminal_get_has_selection (VTE_TERMINAL (screen)); |
1177 | + |
1178 | + action = gtk_action_group_get_action (priv->action_group, "EditCopy"); |
1179 | + gtk_action_set_sensitive (action, can_copy); |
1180 | +} |
1181 | + |
1182 | +static void |
1183 | +terminal_window_update_zoom_sensitivity (TerminalWindow *window) |
1184 | +{ |
1185 | + TerminalWindowPrivate *priv = window->priv; |
1186 | + TerminalScreen *screen; |
1187 | + GtkAction *action; |
1188 | + double current, zoom; |
1189 | + |
1190 | + screen = priv->active_screen; |
1191 | + if (screen == NULL) |
1192 | + return; |
1193 | + |
1194 | + current = terminal_screen_get_font_scale (screen); |
1195 | + |
1196 | + action = gtk_action_group_get_action (priv->action_group, "ViewZoomOut"); |
1197 | + gtk_action_set_sensitive (action, find_smaller_zoom_factor (current, &zoom)); |
1198 | + action = gtk_action_group_get_action (priv->action_group, "ViewZoomIn"); |
1199 | + gtk_action_set_sensitive (action, find_larger_zoom_factor (current, &zoom)); |
1200 | +} |
1201 | + |
1202 | +static void |
1203 | +terminal_window_update_search_sensitivity (TerminalScreen *screen, |
1204 | + TerminalWindow *window) |
1205 | +{ |
1206 | + TerminalWindowPrivate *priv = window->priv; |
1207 | + GtkAction *action; |
1208 | + gboolean can_search; |
1209 | + |
1210 | + if (screen != priv->active_screen) |
1211 | + return; |
1212 | + |
1213 | + can_search = vte_terminal_search_get_gregex (VTE_TERMINAL (screen)) != NULL; |
1214 | + |
1215 | + action = gtk_action_group_get_action (priv->action_group, "SearchFindNext"); |
1216 | + gtk_action_set_sensitive (action, can_search); |
1217 | + action = gtk_action_group_get_action (priv->action_group, "SearchFindPrevious"); |
1218 | + gtk_action_set_sensitive (action, can_search); |
1219 | + action = gtk_action_group_get_action (priv->action_group, "SearchClearHighlight"); |
1220 | + gtk_action_set_sensitive (action, can_search); |
1221 | +} |
1222 | + |
1223 | +static void |
1224 | +update_edit_menu_cb (GtkClipboard *clipboard, |
1225 | + GdkAtom *targets, |
1226 | + int n_targets, |
1227 | + TerminalWindow *window) |
1228 | +{ |
1229 | + TerminalWindowPrivate *priv = window->priv; |
1230 | + GtkAction *action; |
1231 | + gboolean can_paste, can_paste_uris; |
1232 | + |
1233 | + can_paste = targets != NULL && gtk_targets_include_text (targets, n_targets); |
1234 | + can_paste_uris = targets != NULL && gtk_targets_include_uri (targets, n_targets); |
1235 | + |
1236 | + action = gtk_action_group_get_action (priv->action_group, "EditPaste"); |
1237 | + gtk_action_set_sensitive (action, can_paste); |
1238 | + action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths"); |
1239 | + gtk_action_set_visible (action, can_paste_uris); |
1240 | + gtk_action_set_sensitive (action, can_paste_uris); |
1241 | + |
1242 | + /* Ref was added in gtk_clipboard_request_targets below */ |
1243 | + g_object_unref (window); |
1244 | +} |
1245 | + |
1246 | +static void |
1247 | +edit_menu_activate_callback (GtkMenuItem *menuitem, |
1248 | + gpointer user_data) |
1249 | +{ |
1250 | + TerminalWindow *window = (TerminalWindow *) user_data; |
1251 | + GtkClipboard *clipboard; |
1252 | + |
1253 | + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); |
1254 | + gtk_clipboard_request_targets (clipboard, |
1255 | + (GtkClipboardTargetsReceivedFunc) update_edit_menu_cb, |
1256 | + g_object_ref (window)); |
1257 | +} |
1258 | + |
1259 | +static void |
1260 | +screen_resize_window_cb (TerminalScreen *screen, |
1261 | + guint width, |
1262 | + guint height, |
1263 | + TerminalWindow* window) |
1264 | +{ |
1265 | + TerminalWindowPrivate *priv = window->priv; |
1266 | + VteTerminal *terminal = VTE_TERMINAL (screen); |
1267 | + GtkWidget *widget = GTK_WIDGET (screen); |
1268 | + guint grid_width, grid_height; |
1269 | + int char_width, char_height; |
1270 | + GtkBorder *inner_border = NULL; |
1271 | + GtkAllocation widget_allocation; |
1272 | + |
1273 | + gtk_widget_get_allocation (widget, &widget_allocation); |
1274 | + /* Don't do anything if we're maximised or fullscreened */ |
1275 | + // FIXME: realized && ... instead? |
1276 | + if (!gtk_widget_get_realized (widget) || |
1277 | + (gdk_window_get_state (gtk_widget_get_window (widget)) & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) != 0) |
1278 | + return; |
1279 | + |
1280 | + /* NOTE: width and height already include the VteTerminal's padding! */ |
1281 | + |
1282 | + /* Short-circuit */ |
1283 | + if (((int) width) == widget_allocation.width && |
1284 | + ((int) height) == widget_allocation.height) |
1285 | + return; |
1286 | + |
1287 | + /* The resize-window signal sucks. Re-compute grid widths */ |
1288 | + |
1289 | + char_width = vte_terminal_get_char_width (terminal); |
1290 | + char_height = vte_terminal_get_char_height (terminal); |
1291 | + |
1292 | + gtk_widget_style_get (GTK_WIDGET (terminal), "inner-border", &inner_border, NULL); |
1293 | + grid_width = (width - (inner_border ? (inner_border->left + inner_border->right) : 0)) / char_width; |
1294 | + grid_height = (height - (inner_border ? (inner_border->top + inner_border->bottom) : 0)) / char_height; |
1295 | + gtk_border_free (inner_border); |
1296 | + |
1297 | + vte_terminal_set_size (terminal, grid_width, grid_height); |
1298 | + |
1299 | + if (screen != priv->active_screen) |
1300 | + return; |
1301 | + |
1302 | + terminal_window_set_size_force_grid (window, screen, TRUE, -1, -1); //grid_width, grid_height); |
1303 | +} |
1304 | + |
1305 | +static void |
1306 | +terminal_window_update_tabs_menu_sensitivity (TerminalWindow *window) |
1307 | +{ |
1308 | + TerminalWindowPrivate *priv = window->priv; |
1309 | + GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook); |
1310 | + GtkActionGroup *action_group = priv->action_group; |
1311 | + GtkAction *action; |
1312 | + int num_pages, page_num; |
1313 | + gboolean not_first, not_last; |
1314 | + |
1315 | + if (priv->disposed) |
1316 | + return; |
1317 | + |
1318 | + num_pages = gtk_notebook_get_n_pages (notebook); |
1319 | + page_num = gtk_notebook_get_current_page (notebook); |
1320 | + not_first = page_num > 0; |
1321 | + not_last = page_num + 1 < num_pages; |
1322 | + |
1323 | + /* Hide the tabs menu in single-tab windows */ |
1324 | + action = gtk_action_group_get_action (action_group, "Tabs"); |
1325 | + gtk_action_set_visible (action, num_pages > 1); |
1326 | + |
1327 | +#if 1 |
1328 | + /* NOTE: We always make next/prev actions sensitive except in |
1329 | + * single-tab windows, so the corresponding shortcut key escape code |
1330 | + * isn't sent to the terminal. See bug #453193 and bug #138609. |
1331 | + * This also makes tab cycling work, bug #92139. |
1332 | + * FIXME: Find a better way to do this. |
1333 | + */ |
1334 | + action = gtk_action_group_get_action (action_group, "TabsPrevious"); |
1335 | + gtk_action_set_sensitive (action, num_pages > 1); |
1336 | + action = gtk_action_group_get_action (action_group, "TabsNext"); |
1337 | + gtk_action_set_sensitive (action, num_pages > 1); |
1338 | +#else |
1339 | + /* This would be correct, but see the comment above. */ |
1340 | + action = gtk_action_group_get_action (action_group, "TabsPrevious"); |
1341 | + gtk_action_set_sensitive (action, not_first); |
1342 | + action = gtk_action_group_get_action (action_group, "TabsNext"); |
1343 | + gtk_action_set_sensitive (action, not_last); |
1344 | +#endif |
1345 | + |
1346 | + action = gtk_action_group_get_action (action_group, "TabsMoveLeft"); |
1347 | + gtk_action_set_sensitive (action, not_first); |
1348 | + action = gtk_action_group_get_action (action_group, "TabsMoveRight"); |
1349 | + gtk_action_set_sensitive (action, not_last); |
1350 | + action = gtk_action_group_get_action (action_group, "TabsDetach"); |
1351 | + gtk_action_set_sensitive (action, num_pages > 1); |
1352 | + action = gtk_action_group_get_action (action_group, "FileCloseTab"); |
1353 | + gtk_action_set_sensitive (action, num_pages > 1); |
1354 | +} |
1355 | + |
1356 | +gboolean |
1357 | +terminal_window_uses_argb_visual (TerminalWindow *window) |
1358 | +{ |
1359 | + TerminalWindowPrivate *priv = window->priv; |
1360 | + return priv->have_argb_visual; |
1361 | +} |
1362 | + |
1363 | +static void |
1364 | +update_tab_visibility (TerminalWindow *window, |
1365 | + int change) |
1366 | +{ |
1367 | + TerminalWindowPrivate *priv = window->priv; |
1368 | + gboolean show_tabs; |
1369 | + guint num; |
1370 | + |
1371 | + num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)); |
1372 | + |
1373 | + show_tabs = (num + change) > 1; |
1374 | + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), show_tabs); |
1375 | +} |
1376 | + |
1377 | +static GtkNotebook * |
1378 | +handle_tab_droped_on_desktop (GtkNotebook *source_notebook, |
1379 | + GtkWidget *container, |
1380 | + gint x, |
1381 | + gint y, |
1382 | + gpointer data) |
1383 | +{ |
1384 | + TerminalScreen *screen; |
1385 | + TerminalWindow *source_window; |
1386 | + TerminalWindow *new_window; |
1387 | + TerminalWindowPrivate *new_priv; |
1388 | + |
1389 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container)); |
1390 | + source_window = TERMINAL_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (source_notebook))); |
1391 | + g_return_val_if_fail (TERMINAL_IS_WINDOW (source_window), NULL); |
1392 | + |
1393 | + new_window = terminal_app_new_window (terminal_app_get (), |
1394 | + gtk_widget_get_screen (GTK_WIDGET (source_window))); |
1395 | + new_priv = new_window->priv; |
1396 | + new_priv->present_on_insert = TRUE; |
1397 | + |
1398 | + update_tab_visibility (source_window, -1); |
1399 | + update_tab_visibility (new_window, +1); |
1400 | + |
1401 | + return GTK_NOTEBOOK (new_priv->notebook); |
1402 | +} |
1403 | + |
1404 | +/* Terminal screen popup menu handling */ |
1405 | + |
1406 | +static void |
1407 | +popup_open_url_callback (GtkAction *action, |
1408 | + TerminalWindow *window) |
1409 | +{ |
1410 | + TerminalWindowPrivate *priv = window->priv; |
1411 | + TerminalScreenPopupInfo *info = priv->popup_info; |
1412 | + |
1413 | + if (info == NULL) |
1414 | + return; |
1415 | + |
1416 | + terminal_util_open_url (GTK_WIDGET (window), info->string, info->flavour, |
1417 | + gtk_get_current_event_time ()); |
1418 | +} |
1419 | + |
1420 | +static void |
1421 | +popup_copy_url_callback (GtkAction *action, |
1422 | + TerminalWindow *window) |
1423 | +{ |
1424 | + TerminalWindowPrivate *priv = window->priv; |
1425 | + TerminalScreenPopupInfo *info = priv->popup_info; |
1426 | + GtkClipboard *clipboard; |
1427 | + |
1428 | + if (info == NULL) |
1429 | + return; |
1430 | + |
1431 | + if (info->string == NULL) |
1432 | + return; |
1433 | + |
1434 | + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); |
1435 | + gtk_clipboard_set_text (clipboard, info->string, -1); |
1436 | +} |
1437 | + |
1438 | +static void |
1439 | +popup_leave_fullscreen_callback (GtkAction *action, |
1440 | + TerminalWindow *window) |
1441 | +{ |
1442 | + gtk_window_unfullscreen (GTK_WINDOW (window)); |
1443 | +} |
1444 | + |
1445 | +static void |
1446 | +remove_popup_info (TerminalWindow *window) |
1447 | +{ |
1448 | + TerminalWindowPrivate *priv = window->priv; |
1449 | + |
1450 | + if (priv->remove_popup_info_idle != 0) |
1451 | + { |
1452 | + g_source_remove (priv->remove_popup_info_idle); |
1453 | + priv->remove_popup_info_idle = 0; |
1454 | + } |
1455 | + |
1456 | + if (priv->popup_info != NULL) |
1457 | + { |
1458 | + terminal_screen_popup_info_unref (priv->popup_info); |
1459 | + priv->popup_info = NULL; |
1460 | + } |
1461 | +} |
1462 | + |
1463 | +static gboolean |
1464 | +idle_remove_popup_info (TerminalWindow *window) |
1465 | +{ |
1466 | + TerminalWindowPrivate *priv = window->priv; |
1467 | + |
1468 | + priv->remove_popup_info_idle = 0; |
1469 | + remove_popup_info (window); |
1470 | + return FALSE; |
1471 | +} |
1472 | + |
1473 | +static void |
1474 | +unset_popup_info (TerminalWindow *window) |
1475 | +{ |
1476 | + TerminalWindowPrivate *priv = window->priv; |
1477 | + |
1478 | + /* Unref the event from idle since we still need it |
1479 | + * from the action callbacks which will run before idle. |
1480 | + */ |
1481 | + if (priv->remove_popup_info_idle == 0 && |
1482 | + priv->popup_info != NULL) |
1483 | + { |
1484 | + priv->remove_popup_info_idle = |
1485 | + g_idle_add ((GSourceFunc) idle_remove_popup_info, window); |
1486 | + } |
1487 | +} |
1488 | + |
1489 | +static void |
1490 | +popup_menu_deactivate_callback (GtkWidget *popup, |
1491 | + TerminalWindow *window) |
1492 | +{ |
1493 | + TerminalWindowPrivate *priv = window->priv; |
1494 | + GtkWidget *im_menu_item; |
1495 | + |
1496 | + g_signal_handlers_disconnect_by_func |
1497 | + (popup, G_CALLBACK (popup_menu_deactivate_callback), window); |
1498 | + |
1499 | + im_menu_item = gtk_ui_manager_get_widget (priv->ui_manager, |
1500 | + "/Popup/PopupInputMethods"); |
1501 | + gtk_menu_item_set_submenu (GTK_MENU_ITEM (im_menu_item), NULL); |
1502 | + |
1503 | + unset_popup_info (window); |
1504 | +} |
1505 | + |
1506 | +static void |
1507 | +popup_clipboard_targets_received_cb (GtkClipboard *clipboard, |
1508 | + GdkAtom *targets, |
1509 | + int n_targets, |
1510 | + TerminalScreenPopupInfo *info) |
1511 | +{ |
1512 | + TerminalWindow *window = info->window; |
1513 | + TerminalWindowPrivate *priv = window->priv; |
1514 | + TerminalScreen *screen = info->screen; |
1515 | + GtkWidget *popup_menu, *im_menu, *im_menu_item; |
1516 | + GtkAction *action; |
1517 | + gboolean can_paste, can_paste_uris, show_link, show_email_link, show_call_link, show_input_method_menu; |
1518 | + int n_pages; |
1519 | + |
1520 | + if (!gtk_widget_get_realized (GTK_WIDGET (screen))) |
1521 | + { |
1522 | + terminal_screen_popup_info_unref (info); |
1523 | + return; |
1524 | + } |
1525 | + |
1526 | + /* Now we know that the screen is realized, we know that the window is still alive */ |
1527 | + remove_popup_info (window); |
1528 | + |
1529 | + priv->popup_info = info; /* adopt the ref added when requesting the clipboard */ |
1530 | + |
1531 | + n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)); |
1532 | + |
1533 | + can_paste = targets != NULL && gtk_targets_include_text (targets, n_targets); |
1534 | + can_paste_uris = targets != NULL && gtk_targets_include_uri (targets, n_targets); |
1535 | + show_link = info->string != NULL && (info->flavour == FLAVOR_AS_IS || info->flavour == FLAVOR_DEFAULT_TO_HTTP); |
1536 | + show_email_link = info->string != NULL && info->flavour == FLAVOR_EMAIL; |
1537 | + show_call_link = info->string != NULL && info->flavour == FLAVOR_VOIP_CALL; |
1538 | + |
1539 | + action = gtk_action_group_get_action (priv->action_group, "PopupSendEmail"); |
1540 | + gtk_action_set_visible (action, show_email_link); |
1541 | + action = gtk_action_group_get_action (priv->action_group, "PopupCopyEmailAddress"); |
1542 | + gtk_action_set_visible (action, show_email_link); |
1543 | + action = gtk_action_group_get_action (priv->action_group, "PopupCall"); |
1544 | + gtk_action_set_visible (action, show_call_link); |
1545 | + action = gtk_action_group_get_action (priv->action_group, "PopupCopyCallAddress"); |
1546 | + gtk_action_set_visible (action, show_call_link); |
1547 | + action = gtk_action_group_get_action (priv->action_group, "PopupOpenLink"); |
1548 | + gtk_action_set_visible (action, show_link); |
1549 | + action = gtk_action_group_get_action (priv->action_group, "PopupCopyLinkAddress"); |
1550 | + gtk_action_set_visible (action, show_link); |
1551 | + |
1552 | + action = gtk_action_group_get_action (priv->action_group, "PopupCloseWindow"); |
1553 | + gtk_action_set_visible (action, n_pages <= 1); |
1554 | + action = gtk_action_group_get_action (priv->action_group, "PopupCloseTab"); |
1555 | + gtk_action_set_visible (action, n_pages > 1); |
1556 | + |
1557 | + action = gtk_action_group_get_action (priv->action_group, "PopupCopy"); |
1558 | + gtk_action_set_sensitive (action, vte_terminal_get_has_selection (VTE_TERMINAL (screen))); |
1559 | + action = gtk_action_group_get_action (priv->action_group, "PopupPaste"); |
1560 | + gtk_action_set_sensitive (action, can_paste); |
1561 | + action = gtk_action_group_get_action (priv->action_group, "PopupPasteURIPaths"); |
1562 | + gtk_action_set_visible (action, can_paste_uris); |
1563 | + |
1564 | + g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)), |
1565 | + "gtk-show-input-method-menu", &show_input_method_menu, |
1566 | + NULL); |
1567 | + |
1568 | + action = gtk_action_group_get_action (priv->action_group, "PopupInputMethods"); |
1569 | + gtk_action_set_visible (action, show_input_method_menu); |
1570 | + |
1571 | + im_menu_item = gtk_ui_manager_get_widget (priv->ui_manager, |
1572 | + "/Popup/PopupInputMethods"); |
1573 | + /* FIXME: fix this when gtk+ bug #500065 is done, use vte_terminal_im_merge_ui */ |
1574 | + if (show_input_method_menu) |
1575 | + { |
1576 | + im_menu = gtk_menu_new (); |
1577 | + vte_terminal_im_append_menuitems (VTE_TERMINAL (screen), |
1578 | + GTK_MENU_SHELL (im_menu)); |
1579 | + gtk_widget_show (im_menu); |
1580 | + gtk_menu_item_set_submenu (GTK_MENU_ITEM (im_menu_item), im_menu); |
1581 | + } |
1582 | + else |
1583 | + { |
1584 | + gtk_menu_item_set_submenu (GTK_MENU_ITEM (im_menu_item), NULL); |
1585 | + } |
1586 | + |
1587 | + popup_menu = gtk_ui_manager_get_widget (priv->ui_manager, "/Popup"); |
1588 | + g_signal_connect (popup_menu, "deactivate", |
1589 | + G_CALLBACK (popup_menu_deactivate_callback), window); |
1590 | + |
1591 | + /* Pseudo activation of the popup menu's action */ |
1592 | + action = gtk_action_group_get_action (priv->action_group, "Popup"); |
1593 | + gtk_action_activate (action); |
1594 | + |
1595 | + if (info->button == 0) |
1596 | + gtk_menu_shell_select_first (GTK_MENU_SHELL (popup_menu), FALSE); |
1597 | + |
1598 | + gtk_menu_popup (GTK_MENU (popup_menu), |
1599 | + NULL, NULL, |
1600 | + NULL, NULL, |
1601 | + info->button, |
1602 | + info->timestamp); |
1603 | +} |
1604 | + |
1605 | +static void |
1606 | +screen_show_popup_menu_callback (TerminalScreen *screen, |
1607 | + TerminalScreenPopupInfo *info, |
1608 | + TerminalWindow *window) |
1609 | +{ |
1610 | + GtkClipboard *clipboard; |
1611 | + |
1612 | + g_return_if_fail (info->window == window); |
1613 | + |
1614 | + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); |
1615 | + gtk_clipboard_request_targets (clipboard, |
1616 | + (GtkClipboardTargetsReceivedFunc) popup_clipboard_targets_received_cb, |
1617 | + terminal_screen_popup_info_ref (info)); |
1618 | +} |
1619 | + |
1620 | +static gboolean |
1621 | +screen_match_clicked_cb (TerminalScreen *screen, |
1622 | + const char *match, |
1623 | + int flavour, |
1624 | + guint state, |
1625 | + TerminalWindow *window) |
1626 | +{ |
1627 | + TerminalWindowPrivate *priv = window->priv; |
1628 | + |
1629 | + if (screen != priv->active_screen) |
1630 | + return FALSE; |
1631 | + |
1632 | + switch (flavour) |
1633 | + { |
1634 | +#ifdef ENABLE_SKEY |
1635 | + case FLAVOR_SKEY: |
1636 | + terminal_skey_do_popup (GTK_WINDOW (window), screen, match); |
1637 | + break; |
1638 | +#endif |
1639 | + default: |
1640 | + gtk_widget_grab_focus (GTK_WIDGET (screen)); |
1641 | + terminal_util_open_url (GTK_WIDGET (window), match, flavour, |
1642 | + gtk_get_current_event_time ()); |
1643 | + break; |
1644 | + } |
1645 | + |
1646 | + return TRUE; |
1647 | +} |
1648 | + |
1649 | +static void |
1650 | +screen_close_cb (TerminalScreen *screen, |
1651 | + TerminalWindow *window) |
1652 | +{ |
1653 | + terminal_window_remove_screen (window, screen); |
1654 | +} |
1655 | + |
1656 | +static gboolean |
1657 | +terminal_window_accel_activate_cb (GtkAccelGroup *accel_group, |
1658 | + GObject *acceleratable, |
1659 | + guint keyval, |
1660 | + GdkModifierType modifier, |
1661 | + TerminalWindow *window) |
1662 | +{ |
1663 | + GtkAccelGroupEntry *entries; |
1664 | + guint n_entries; |
1665 | + gboolean retval = FALSE; |
1666 | + |
1667 | + entries = gtk_accel_group_query (accel_group, keyval, modifier, &n_entries); |
1668 | + if (n_entries > 0) |
1669 | + { |
1670 | + const char *accel_path; |
1671 | + |
1672 | + accel_path = g_quark_to_string (entries[0].accel_path_quark); |
1673 | + |
1674 | + if (g_str_has_prefix (accel_path, "<Actions>/Main/")) |
1675 | + { |
1676 | + const char *action_name; |
1677 | + |
1678 | + /* We want to always consume these accelerators, even if the corresponding |
1679 | + * action is insensitive, so the corresponding shortcut key escape code |
1680 | + * isn't sent to the terminal. See bug #453193, bug #138609 and bug #559728. |
1681 | + * This also makes tab cycling work, bug #92139. (NOT!) |
1682 | + */ |
1683 | + |
1684 | + action_name = I_(accel_path + strlen ("<Actions>/Main/")); |
1685 | + |
1686 | +#if 0 |
1687 | + if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) > 1 && |
1688 | + (action_name == I_("TabsPrevious") || action_name == I_("TabsNext"))) |
1689 | + retval = TRUE; |
1690 | + else |
1691 | +#endif |
1692 | + if (action_name == I_("EditCopy") || |
1693 | + action_name == I_("PopupCopy") || |
1694 | + action_name == I_("EditPaste") || |
1695 | + action_name == I_("PopupPaste")) |
1696 | + retval = TRUE; |
1697 | + } |
1698 | + } |
1699 | + |
1700 | + return retval; |
1701 | +} |
1702 | + |
1703 | +/*****************************************/ |
1704 | + |
1705 | +#ifdef GNOME_ENABLE_DEBUG |
1706 | +static void |
1707 | +terminal_window_size_request_cb (GtkWidget *widget, |
1708 | + GtkRequisition *req) |
1709 | +{ |
1710 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
1711 | + "[window %p] size-request result %d : %d\n", |
1712 | + widget, req->width, req->height); |
1713 | +} |
1714 | + |
1715 | +static void |
1716 | +terminal_window_size_allocate_cb (GtkWidget *widget, |
1717 | + GtkAllocation *allocation) |
1718 | +{ |
1719 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
1720 | + "[window %p] size-alloc result %d : %d at (%d, %d)\n", |
1721 | + widget, |
1722 | + allocation->width, allocation->height, |
1723 | + allocation->x, allocation->y); |
1724 | +} |
1725 | +#endif /* GNOME_ENABLE_DEBUG */ |
1726 | + |
1727 | +static void |
1728 | +terminal_window_realize (GtkWidget *widget) |
1729 | +{ |
1730 | + TerminalWindow *window = TERMINAL_WINDOW (widget); |
1731 | + TerminalWindowPrivate *priv = window->priv; |
1732 | +#ifdef GDK_WINDOWING_X11 |
1733 | + GdkScreen *screen; |
1734 | + GdkColormap *colormap; |
1735 | + GtkAllocation widget_allocation; |
1736 | + |
1737 | + gtk_widget_get_allocation (widget, &widget_allocation); |
1738 | + screen = gtk_widget_get_screen (GTK_WIDGET (window)); |
1739 | + if (gdk_screen_is_composited (screen) && |
1740 | + (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL) |
1741 | + { |
1742 | + /* Set RGBA colormap if possible so VTE can use real transparency */ |
1743 | + gtk_widget_set_colormap (widget, colormap); |
1744 | + priv->have_argb_visual = TRUE; |
1745 | + } |
1746 | + else |
1747 | + { |
1748 | + gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen)); |
1749 | + priv->have_argb_visual = FALSE; |
1750 | + } |
1751 | +#endif |
1752 | + |
1753 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
1754 | + "[window %p] realize, size %d : %d at (%d, %d)\n", |
1755 | + widget, |
1756 | + widget_allocation.width, widget_allocation.height, |
1757 | + widget_allocation.x, widget_allocation.y); |
1758 | + |
1759 | + GTK_WIDGET_CLASS (terminal_window_parent_class)->realize (widget); |
1760 | + |
1761 | + /* Need to do this now since this requires the window to be realized */ |
1762 | + if (priv->active_screen != NULL) |
1763 | + sync_screen_icon_title (priv->active_screen, NULL, window); |
1764 | +} |
1765 | + |
1766 | +static gboolean |
1767 | +terminal_window_map_event (GtkWidget *widget, |
1768 | + GdkEventAny *event) |
1769 | +{ |
1770 | + TerminalWindow *window = TERMINAL_WINDOW (widget); |
1771 | + TerminalWindowPrivate *priv = window->priv; |
1772 | + gboolean (* map_event) (GtkWidget *, GdkEventAny *) = |
1773 | + GTK_WIDGET_CLASS (terminal_window_parent_class)->map_event; |
1774 | + GtkAllocation widget_allocation; |
1775 | + |
1776 | + gtk_widget_get_allocation (widget, &widget_allocation); |
1777 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
1778 | + "[window %p] map-event, size %d : %d at (%d, %d)\n", |
1779 | + widget, |
1780 | + widget_allocation.width, widget_allocation.height, |
1781 | + widget_allocation.x, widget_allocation.y); |
1782 | + |
1783 | + if (priv->clear_demands_attention) |
1784 | + { |
1785 | +#ifdef GDK_WINDOWING_X11 |
1786 | + terminal_util_x11_clear_demands_attention (gtk_widget_get_window (widget)); |
1787 | +#endif |
1788 | + |
1789 | + priv->clear_demands_attention = FALSE; |
1790 | + } |
1791 | + |
1792 | + if (map_event) |
1793 | + return map_event (widget, event); |
1794 | + |
1795 | + return FALSE; |
1796 | +} |
1797 | + |
1798 | + |
1799 | +static gboolean |
1800 | +terminal_window_state_event (GtkWidget *widget, |
1801 | + GdkEventWindowState *event) |
1802 | +{ |
1803 | + gboolean (* window_state_event) (GtkWidget *, GdkEventWindowState *event) = |
1804 | + GTK_WIDGET_CLASS (terminal_window_parent_class)->window_state_event; |
1805 | + |
1806 | + if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) |
1807 | + { |
1808 | + TerminalWindow *window = TERMINAL_WINDOW (widget); |
1809 | + TerminalWindowPrivate *priv = window->priv; |
1810 | + GtkAction *action; |
1811 | + gboolean is_fullscreen; |
1812 | + |
1813 | + is_fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0; |
1814 | + |
1815 | + action = gtk_action_group_get_action (priv->action_group, "ViewFullscreen"); |
1816 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_fullscreen); |
1817 | + |
1818 | + action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen"); |
1819 | + gtk_action_set_visible (action, is_fullscreen); |
1820 | + } |
1821 | + |
1822 | + if (window_state_event) |
1823 | + return window_state_event (widget, event); |
1824 | + |
1825 | + return FALSE; |
1826 | +} |
1827 | + |
1828 | +static void |
1829 | +terminal_window_window_manager_changed_cb (GdkScreen *screen, |
1830 | + TerminalWindow *window) |
1831 | +{ |
1832 | + TerminalWindowPrivate *priv = window->priv; |
1833 | + GtkAction *action; |
1834 | + gboolean supports_fs; |
1835 | + |
1836 | + supports_fs = gdk_x11_screen_supports_net_wm_hint (screen, gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE)); |
1837 | + |
1838 | + action = gtk_action_group_get_action (priv->action_group, "ViewFullscreen"); |
1839 | + gtk_action_set_sensitive (action, supports_fs); |
1840 | +} |
1841 | + |
1842 | +#ifdef GDK_WINDOWING_X11 |
1843 | + |
1844 | +static void |
1845 | +terminal_window_composited_changed_cb (GdkScreen *screen, |
1846 | + TerminalWindow *window) |
1847 | +{ |
1848 | + TerminalWindowPrivate *priv = window->priv; |
1849 | + gboolean composited; |
1850 | + |
1851 | + composited = gdk_screen_is_composited (screen); |
1852 | + if ((composited != priv->have_argb_visual) && |
1853 | + gtk_widget_get_realized (GTK_WIDGET (window))) |
1854 | + { |
1855 | + GtkWidget *widget = GTK_WIDGET (window); |
1856 | + GdkWindow *widget_window; |
1857 | + guint32 user_time; |
1858 | + gboolean have_desktop; |
1859 | + guint32 desktop = 0; /* Quiet GCC */ |
1860 | + gboolean was_minimized; |
1861 | + int x, y; |
1862 | + |
1863 | + widget_window = gtk_widget_get_window (widget); |
1864 | + |
1865 | + user_time = gdk_x11_display_get_user_time (gtk_widget_get_display (widget)); |
1866 | + |
1867 | + /* If compositing changed, re-realize the window. Bug #563561 */ |
1868 | + |
1869 | + /* Save the position; this isn't perfect, because the position |
1870 | + * that gtk_window_get_position() returns is the position of the |
1871 | + * frame window, and we are racing with the new window manager |
1872 | + * framing our window, so we might see a funky intermediate state. |
1873 | + * But at worst, we'll be off by a few pixels (the frame size). */ |
1874 | + gtk_window_get_position (GTK_WINDOW (window), &x, &y); |
1875 | + |
1876 | + /* GtkWindow tries to save whether the window was iconified |
1877 | + * and restore it, but that doesn't work because of problems |
1878 | + * GDK_WINDOW_STATE_ICONIFIED. For details, see comment for |
1879 | + * terminal_util_x11_window_is_minimized() |
1880 | + */ |
1881 | + was_minimized = terminal_util_x11_window_is_minimized (widget_window); |
1882 | + |
1883 | + /* And the desktop */ |
1884 | + have_desktop = terminal_util_x11_get_net_wm_desktop (widget_window, &desktop); |
1885 | + |
1886 | + gtk_widget_hide (widget); |
1887 | + gtk_widget_unrealize (widget); |
1888 | + |
1889 | + /* put the window back where it was before */ |
1890 | + gtk_window_move (GTK_WINDOW (window), x, y); |
1891 | + gtk_widget_realize (widget); |
1892 | + |
1893 | + /* Get new GdkWindow */ |
1894 | + widget_window = gtk_widget_get_window (widget); |
1895 | + |
1896 | + gdk_x11_window_set_user_time (widget_window, user_time); |
1897 | + |
1898 | + if (was_minimized) |
1899 | + gtk_window_iconify (GTK_WINDOW (window)); |
1900 | + else |
1901 | + gtk_window_deiconify (GTK_WINDOW (window)); |
1902 | + |
1903 | + gtk_widget_show (widget); |
1904 | + if (have_desktop) |
1905 | + terminal_util_x11_set_net_wm_desktop (widget_window, desktop); |
1906 | + |
1907 | + /* Mapping the window is likely to have set the "demands-attention" state. |
1908 | + * In particular, Metacity will always set the state if a window is mapped, |
1909 | + * is not given the focus (because of an old user time), and is covered |
1910 | + * by some other window. We have no way of preventing this, so we just |
1911 | + * wait for our window to be mapped, and then tell the window manager |
1912 | + * to turn off the bit. If it wasn't set, no harm. |
1913 | + */ |
1914 | + priv->clear_demands_attention = TRUE; |
1915 | + } |
1916 | +} |
1917 | + |
1918 | +#endif /* GDK_WINDOWING_X11 */ |
1919 | + |
1920 | +static void |
1921 | +terminal_window_screen_update (TerminalWindow *window, |
1922 | + GdkScreen *screen) |
1923 | +{ |
1924 | + TerminalApp *app; |
1925 | + |
1926 | + terminal_window_window_manager_changed_cb (screen, window); |
1927 | + g_signal_connect (screen, "window-manager-changed", |
1928 | + G_CALLBACK (terminal_window_window_manager_changed_cb), window); |
1929 | +#ifdef GDK_WINDOWING_X11 |
1930 | + g_signal_connect (screen, "composited-changed", |
1931 | + G_CALLBACK (terminal_window_composited_changed_cb), window); |
1932 | +#endif |
1933 | + |
1934 | + if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection"))) |
1935 | + return; |
1936 | + |
1937 | + g_object_set_data_full (G_OBJECT (screen), "GT::HasSettingsConnection", |
1938 | + GINT_TO_POINTER (TRUE), |
1939 | + (GDestroyNotify) app_setting_notify_destroy_cb); |
1940 | + |
1941 | + app = terminal_app_get (); |
1942 | + app_setting_notify_cb (app, NULL, screen); |
1943 | + g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MNEMONICS, |
1944 | + G_CALLBACK (app_setting_notify_cb), screen); |
1945 | + g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, |
1946 | + G_CALLBACK (app_setting_notify_cb), screen); |
1947 | +} |
1948 | + |
1949 | +static void |
1950 | +terminal_window_screen_changed (GtkWidget *widget, |
1951 | + GdkScreen *previous_screen) |
1952 | +{ |
1953 | + TerminalWindow *window = TERMINAL_WINDOW (widget); |
1954 | + void (* screen_changed) (GtkWidget *, GdkScreen *) = |
1955 | + GTK_WIDGET_CLASS (terminal_window_parent_class)->screen_changed; |
1956 | + GdkScreen *screen; |
1957 | + |
1958 | + if (screen_changed) |
1959 | + screen_changed (widget, previous_screen); |
1960 | + |
1961 | + screen = gtk_widget_get_screen (widget); |
1962 | + if (previous_screen == screen) |
1963 | + return; |
1964 | + |
1965 | + if (previous_screen) |
1966 | + { |
1967 | + g_signal_handlers_disconnect_by_func (previous_screen, |
1968 | + G_CALLBACK (terminal_window_window_manager_changed_cb), |
1969 | + window); |
1970 | +#ifdef GDK_WINDOWING_X11 |
1971 | + g_signal_handlers_disconnect_by_func (previous_screen, |
1972 | + G_CALLBACK (terminal_window_composited_changed_cb), |
1973 | + window); |
1974 | +#endif |
1975 | + } |
1976 | + |
1977 | + if (!screen) |
1978 | + return; |
1979 | + |
1980 | + terminal_window_screen_update (window, screen); |
1981 | +} |
1982 | + |
1983 | +static void |
1984 | +terminal_window_profile_list_changed_cb (TerminalApp *app, |
1985 | + TerminalWindow *window) |
1986 | +{ |
1987 | + terminal_window_update_set_profile_menu (window); |
1988 | + terminal_window_update_new_terminal_menus (window); |
1989 | +} |
1990 | + |
1991 | +static void |
1992 | +terminal_window_encoding_list_changed_cb (TerminalApp *app, |
1993 | + TerminalWindow *window) |
1994 | +{ |
1995 | + terminal_window_update_encoding_menu (window); |
1996 | +} |
1997 | + |
1998 | +static void |
1999 | +terminal_window_init (TerminalWindow *window) |
2000 | +{ |
2001 | + const GtkActionEntry menu_entries[] = |
2002 | + { |
2003 | + /* Toplevel */ |
2004 | + { "File", NULL, N_("_File") }, |
2005 | + { "FileNewWindowProfiles", STOCK_NEW_WINDOW, N_("Open _Terminal")}, |
2006 | + { "FileNewTabProfiles", STOCK_NEW_TAB, N_("Open Ta_b") }, |
2007 | + { "Edit", NULL, N_("_Edit") }, |
2008 | + { "View", NULL, N_("_View") }, |
2009 | + { "Search", NULL, N_("_Search") }, |
2010 | + { "Terminal", NULL, N_("_Terminal") }, |
2011 | + { "Tabs", NULL, N_("Ta_bs") }, |
2012 | + { "Help", NULL, N_("_Help") }, |
2013 | + { "Popup", NULL, NULL }, |
2014 | + { "NotebookPopup", NULL, "" }, |
2015 | + |
2016 | + /* File menu */ |
2017 | + { "FileNewWindow", STOCK_NEW_WINDOW, N_("Open _Terminal"), "<shift><control>N", |
2018 | + NULL, |
2019 | + G_CALLBACK (file_new_window_callback) }, |
2020 | + { "FileNewTab", STOCK_NEW_TAB, N_("Open Ta_b"), "<shift><control>T", |
2021 | + NULL, |
2022 | + G_CALLBACK (file_new_tab_callback) }, |
2023 | + { "FileNewProfile", GTK_STOCK_OPEN, N_("New _Profile…"), "", |
2024 | + NULL, |
2025 | + G_CALLBACK (file_new_profile_callback) }, |
2026 | + { "FileSaveContents", GTK_STOCK_SAVE, N_("_Save Contents"), "", |
2027 | + NULL, |
2028 | + G_CALLBACK (file_save_contents_callback) }, |
2029 | + { "FileCloseTab", GTK_STOCK_CLOSE, N_("C_lose Tab"), "<shift><control>W", |
2030 | + NULL, |
2031 | + G_CALLBACK (file_close_tab_callback) }, |
2032 | + { "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close Window"), "<shift><control>Q", |
2033 | + NULL, |
2034 | + G_CALLBACK (file_close_window_callback) }, |
2035 | + |
2036 | + /* Edit menu */ |
2037 | + { "EditCopy", GTK_STOCK_COPY, NULL, "<shift><control>C", |
2038 | + NULL, |
2039 | + G_CALLBACK (edit_copy_callback) }, |
2040 | + { "EditPaste", GTK_STOCK_PASTE, NULL, "<shift><control>V", |
2041 | + NULL, |
2042 | + G_CALLBACK (edit_paste_callback) }, |
2043 | + { "EditPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "", |
2044 | + NULL, |
2045 | + G_CALLBACK (edit_paste_callback) }, |
2046 | + { "EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, NULL, |
2047 | + NULL, |
2048 | + G_CALLBACK (edit_select_all_callback) }, |
2049 | + { "EditProfiles", NULL, N_("P_rofiles…"), NULL, |
2050 | + NULL, |
2051 | + G_CALLBACK (edit_profiles_callback) }, |
2052 | + { "EditKeybindings", NULL, N_("_Keyboard Shortcuts…"), NULL, |
2053 | + NULL, |
2054 | + G_CALLBACK (edit_keybindings_callback) }, |
2055 | + { "EditCurrentProfile", NULL, N_("Pr_ofile Preferences"), NULL, |
2056 | + NULL, |
2057 | + G_CALLBACK (edit_current_profile_callback) }, |
2058 | + |
2059 | + /* View menu */ |
2060 | + { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus", |
2061 | + NULL, |
2062 | + G_CALLBACK (view_zoom_in_callback) }, |
2063 | + { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus", |
2064 | + NULL, |
2065 | + G_CALLBACK (view_zoom_out_callback) }, |
2066 | + { "ViewZoom100", GTK_STOCK_ZOOM_100, NULL, "<control>0", |
2067 | + NULL, |
2068 | + G_CALLBACK (view_zoom_normal_callback) }, |
2069 | + |
2070 | + /* Search menu */ |
2071 | + { "SearchFind", GTK_STOCK_FIND, N_("_Find..."), "<shift><control>F", |
2072 | + NULL, |
2073 | + G_CALLBACK (search_find_callback) }, |
2074 | + { "SearchFindNext", NULL, N_("Find Ne_xt"), "<shift><control>H", |
2075 | + NULL, |
2076 | + G_CALLBACK (search_find_next_callback) }, |
2077 | + { "SearchFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G", |
2078 | + NULL, |
2079 | + G_CALLBACK (search_find_prev_callback) }, |
2080 | + { "SearchClearHighlight", NULL, N_("_Clear Highlight"), "<shift><control>J", |
2081 | + NULL, |
2082 | + G_CALLBACK (search_clear_highlight_callback) }, |
2083 | +#if 0 |
2084 | + { "SearchGoToLine", GTK_STOCK_JUMP_TO, N_("Go to _Line..."), "<shift><control>I", |
2085 | + NULL, |
2086 | + G_CALLBACK (search_goto_line_callback) }, |
2087 | + { "SearchIncrementalSearch", GTK_STOCK_FIND, N_("_Incremental Search..."), "<shift><control>K", |
2088 | + NULL, |
2089 | + G_CALLBACK (search_incremental_search_callback) }, |
2090 | +#endif |
2091 | + |
2092 | + /* Terminal menu */ |
2093 | + { "TerminalProfiles", NULL, N_("Change _Profile") }, |
2094 | + { "TerminalSetTitle", NULL, N_("_Set Title…"), NULL, |
2095 | + NULL, |
2096 | + G_CALLBACK (terminal_set_title_callback) }, |
2097 | + { "TerminalSetEncoding", NULL, N_("Set _Character Encoding") }, |
2098 | + { "TerminalReset", NULL, N_("_Reset"), NULL, |
2099 | + NULL, |
2100 | + G_CALLBACK (terminal_reset_callback) }, |
2101 | + { "TerminalResetClear", NULL, N_("Reset and C_lear"), NULL, |
2102 | + NULL, |
2103 | + G_CALLBACK (terminal_reset_clear_callback) }, |
2104 | + |
2105 | + /* Terminal/Encodings menu */ |
2106 | + { "TerminalAddEncoding", NULL, N_("_Add or Remove…"), NULL, |
2107 | + NULL, |
2108 | + G_CALLBACK (terminal_add_encoding_callback) }, |
2109 | + |
2110 | + /* Tabs menu */ |
2111 | + { "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up", |
2112 | + NULL, |
2113 | + G_CALLBACK (tabs_next_or_previous_tab_cb) }, |
2114 | + { "TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down", |
2115 | + NULL, |
2116 | + G_CALLBACK (tabs_next_or_previous_tab_cb) }, |
2117 | + { "TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up", |
2118 | + NULL, |
2119 | + G_CALLBACK (tabs_move_left_callback) }, |
2120 | + { "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down", |
2121 | + NULL, |
2122 | + G_CALLBACK (tabs_move_right_callback) }, |
2123 | + { "TabsDetach", NULL, N_("_Detach tab"), NULL, |
2124 | + NULL, |
2125 | + G_CALLBACK (tabs_detach_tab_callback) }, |
2126 | + |
2127 | + /* Help menu */ |
2128 | + { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", |
2129 | + NULL, |
2130 | + G_CALLBACK (help_contents_callback) }, |
2131 | + { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, |
2132 | + NULL, |
2133 | + G_CALLBACK (help_about_callback) }, |
2134 | + |
2135 | + /* Popup menu */ |
2136 | + { "PopupSendEmail", NULL, N_("_Send Mail To…"), NULL, |
2137 | + NULL, |
2138 | + G_CALLBACK (popup_open_url_callback) }, |
2139 | + { "PopupCopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL, |
2140 | + NULL, |
2141 | + G_CALLBACK (popup_copy_url_callback) }, |
2142 | + { "PopupCall", NULL, N_("C_all To…"), NULL, |
2143 | + NULL, |
2144 | + G_CALLBACK (popup_open_url_callback) }, |
2145 | + { "PopupCopyCallAddress", NULL, N_("_Copy Call Address"), NULL, |
2146 | + NULL, |
2147 | + G_CALLBACK (popup_copy_url_callback) }, |
2148 | + { "PopupOpenLink", NULL, N_("_Open Link"), NULL, |
2149 | + NULL, |
2150 | + G_CALLBACK (popup_open_url_callback) }, |
2151 | + { "PopupCopyLinkAddress", NULL, N_("_Copy Link Address"), NULL, |
2152 | + NULL, |
2153 | + G_CALLBACK (popup_copy_url_callback) }, |
2154 | + { "PopupTerminalProfiles", NULL, N_("P_rofiles") }, |
2155 | + { "PopupCopy", GTK_STOCK_COPY, NULL, "", |
2156 | + NULL, |
2157 | + G_CALLBACK (edit_copy_callback) }, |
2158 | + { "PopupPaste", GTK_STOCK_PASTE, NULL, "", |
2159 | + NULL, |
2160 | + G_CALLBACK (edit_paste_callback) }, |
2161 | + { "PopupPasteURIPaths", GTK_STOCK_PASTE, N_("Paste _Filenames"), "", |
2162 | + NULL, |
2163 | + G_CALLBACK (edit_paste_callback) }, |
2164 | + { "PopupNewTerminal", NULL, N_("Open _Terminal"), NULL, |
2165 | + NULL, |
2166 | + G_CALLBACK (file_new_window_callback) }, |
2167 | + { "PopupNewTab", NULL, N_("Open Ta_b"), NULL, |
2168 | + NULL, |
2169 | + G_CALLBACK (file_new_tab_callback) }, |
2170 | + { "PopupCloseWindow", NULL, N_("C_lose Window"), NULL, |
2171 | + NULL, |
2172 | + G_CALLBACK (file_close_window_callback) }, |
2173 | + { "PopupCloseTab", NULL, N_("C_lose Tab"), NULL, |
2174 | + NULL, |
2175 | + G_CALLBACK (file_close_tab_callback) }, |
2176 | + { "PopupLeaveFullscreen", NULL, N_("L_eave Full Screen"), NULL, |
2177 | + NULL, |
2178 | + G_CALLBACK (popup_leave_fullscreen_callback) }, |
2179 | + { "PopupInputMethods", NULL, N_("_Input Methods") } |
2180 | + }; |
2181 | + |
2182 | + const GtkToggleActionEntry toggle_menu_entries[] = |
2183 | + { |
2184 | + /* View Menu */ |
2185 | + { "ViewMenubar", NULL, N_("Show _Menubar"), NULL, |
2186 | + NULL, |
2187 | + G_CALLBACK (view_menubar_toggled_callback), |
2188 | + FALSE }, |
2189 | + { "ViewFullscreen", NULL, N_("_Full Screen"), NULL, |
2190 | + NULL, |
2191 | + G_CALLBACK (view_fullscreen_toggled_callback), |
2192 | + FALSE } |
2193 | + }; |
2194 | + TerminalWindowPrivate *priv; |
2195 | + TerminalApp *app; |
2196 | + GtkActionGroup *action_group; |
2197 | + GtkAction *action; |
2198 | + GtkUIManager *manager; |
2199 | + GtkWidget *main_vbox; |
2200 | + GError *error; |
2201 | + GtkWindowGroup *window_group; |
2202 | + GtkAccelGroup *accel_group; |
2203 | + |
2204 | + priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate); |
2205 | + |
2206 | + g_signal_connect (G_OBJECT (window), "delete_event", |
2207 | + G_CALLBACK(terminal_window_delete_event), |
2208 | + NULL); |
2209 | +#ifdef GNOME_ENABLE_DEBUG |
2210 | + _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY) |
2211 | + { |
2212 | + g_signal_connect_after (window, "size-request", G_CALLBACK (terminal_window_size_request_cb), NULL); |
2213 | + g_signal_connect_after (window, "size-allocate", G_CALLBACK (terminal_window_size_allocate_cb), NULL); |
2214 | + } |
2215 | +#endif |
2216 | + |
2217 | + gtk_window_set_title (GTK_WINDOW (window), _("Terminal")); |
2218 | + |
2219 | + priv->active_screen = NULL; |
2220 | + priv->menubar_visible = FALSE; |
2221 | + |
2222 | + main_vbox = gtk_vbox_new (FALSE, 0); |
2223 | + gtk_container_add (GTK_CONTAINER (window), main_vbox); |
2224 | + gtk_widget_show (main_vbox); |
2225 | + |
2226 | + priv->notebook = gtk_notebook_new (); |
2227 | + gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE); |
2228 | + gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE); |
2229 | + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE); |
2230 | + gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1)); |
2231 | + gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), |
2232 | + TRUE); |
2233 | + g_signal_connect (priv->notebook, "button-press-event", |
2234 | + G_CALLBACK (notebook_button_press_cb), window); |
2235 | + g_signal_connect (priv->notebook, "popup-menu", |
2236 | + G_CALLBACK (notebook_popup_menu_cb), window); |
2237 | + g_signal_connect_after (priv->notebook, "switch-page", |
2238 | + G_CALLBACK (notebook_page_selected_callback), window); |
2239 | + g_signal_connect_after (priv->notebook, "page-added", |
2240 | + G_CALLBACK (notebook_page_added_callback), window); |
2241 | + g_signal_connect_after (priv->notebook, "page-removed", |
2242 | + G_CALLBACK (notebook_page_removed_callback), window); |
2243 | + g_signal_connect_data (priv->notebook, "page-reordered", |
2244 | + G_CALLBACK (terminal_window_update_tabs_menu_sensitivity), |
2245 | + window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER); |
2246 | + |
2247 | + gtk_box_pack_end (GTK_BOX (main_vbox), priv->notebook, TRUE, TRUE, 0); |
2248 | + gtk_widget_show (priv->notebook); |
2249 | + |
2250 | + priv->old_char_width = -1; |
2251 | + priv->old_char_height = -1; |
2252 | + priv->old_geometry_widget = NULL; |
2253 | + |
2254 | + /* Create the UI manager */ |
2255 | + manager = priv->ui_manager = gtk_ui_manager_new (); |
2256 | + |
2257 | + accel_group = gtk_ui_manager_get_accel_group (manager); |
2258 | + gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); |
2259 | + /* Workaround for bug #453193, bug #138609 and bug #559728 */ |
2260 | + g_signal_connect_after (accel_group, "accel-activate", |
2261 | + G_CALLBACK (terminal_window_accel_activate_cb), window); |
2262 | + |
2263 | + /* Create the actions */ |
2264 | + /* Note that this action group name is used in terminal-accels.c; do not change it */ |
2265 | + priv->action_group = action_group = gtk_action_group_new ("Main"); |
2266 | + gtk_action_group_set_translation_domain (action_group, NULL); |
2267 | + gtk_action_group_add_actions (action_group, menu_entries, |
2268 | + G_N_ELEMENTS (menu_entries), window); |
2269 | + gtk_action_group_add_toggle_actions (action_group, |
2270 | + toggle_menu_entries, |
2271 | + G_N_ELEMENTS (toggle_menu_entries), |
2272 | + window); |
2273 | + gtk_ui_manager_insert_action_group (manager, action_group, 0); |
2274 | + g_object_unref (action_group); |
2275 | + |
2276 | + action = gtk_action_group_get_action (action_group, "Edit"); |
2277 | + g_signal_connect (action, "activate", |
2278 | + G_CALLBACK (edit_menu_activate_callback), window); |
2279 | + |
2280 | + /* Set this action invisible so the Edit menu doesn't flash the first |
2281 | + * time it's shown and there's no text/uri-list on the clipboard. |
2282 | + */ |
2283 | + action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths"); |
2284 | + gtk_action_set_visible (action, FALSE); |
2285 | + |
2286 | + /* Idem for this action, since the window is not fullscreen. */ |
2287 | + action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen"); |
2288 | + gtk_action_set_visible (action, FALSE); |
2289 | + |
2290 | +#ifndef ENABLE_SAVE |
2291 | + action = gtk_action_group_get_action (priv->action_group, "FileSaveContents"); |
2292 | + gtk_action_set_visible (action, FALSE); |
2293 | +#endif |
2294 | + |
2295 | + /* Load the UI */ |
2296 | + error = NULL; |
2297 | + priv->ui_id = gtk_ui_manager_add_ui_from_file (manager, |
2298 | + TERM_PKGDATADIR G_DIR_SEPARATOR_S "terminal.xml", |
2299 | + &error); |
2300 | + if (error) |
2301 | + { |
2302 | + g_printerr ("Failed to load UI: %s\n", error->message); |
2303 | + g_error_free (error); |
2304 | + } |
2305 | + |
2306 | + priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar"); |
2307 | + gtk_box_pack_start (GTK_BOX (main_vbox), |
2308 | + priv->menubar, |
2309 | + FALSE, FALSE, 0); |
2310 | + |
2311 | + /* Add tabs menu */ |
2312 | + priv->tabs_menu = terminal_tabs_menu_new (window); |
2313 | + |
2314 | + app = terminal_app_get (); |
2315 | + terminal_window_profile_list_changed_cb (app, window); |
2316 | + g_signal_connect (app, "profile-list-changed", |
2317 | + G_CALLBACK (terminal_window_profile_list_changed_cb), window); |
2318 | + |
2319 | + terminal_window_encoding_list_changed_cb (app, window); |
2320 | + g_signal_connect (app, "encoding-list-changed", |
2321 | + G_CALLBACK (terminal_window_encoding_list_changed_cb), window); |
2322 | + |
2323 | + terminal_window_set_menubar_visible (window, TRUE); |
2324 | + priv->use_default_menubar_visibility = TRUE; |
2325 | + |
2326 | + terminal_window_update_size_to_menu (window); |
2327 | + |
2328 | + /* We have to explicitly call this, since screen-changed is NOT |
2329 | + * emitted for the toplevel the first time! |
2330 | + */ |
2331 | + terminal_window_screen_update (window, gtk_widget_get_screen (GTK_WIDGET (window))); |
2332 | + |
2333 | + window_group = gtk_window_group_new (); |
2334 | + gtk_window_group_add_window (window_group, GTK_WINDOW (window)); |
2335 | + g_object_unref (window_group); |
2336 | + |
2337 | + terminal_util_set_unique_role (GTK_WINDOW (window), "gnome-terminal-window"); |
2338 | +} |
2339 | + |
2340 | +static void |
2341 | +terminal_window_class_init (TerminalWindowClass *klass) |
2342 | +{ |
2343 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); |
2344 | + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); |
2345 | + |
2346 | + object_class->dispose = terminal_window_dispose; |
2347 | + object_class->finalize = terminal_window_finalize; |
2348 | + |
2349 | + widget_class->show = terminal_window_show; |
2350 | + widget_class->realize = terminal_window_realize; |
2351 | + widget_class->map_event = terminal_window_map_event; |
2352 | + widget_class->window_state_event = terminal_window_state_event; |
2353 | + widget_class->screen_changed = terminal_window_screen_changed; |
2354 | + |
2355 | + g_type_class_add_private (object_class, sizeof (TerminalWindowPrivate)); |
2356 | + |
2357 | + gtk_rc_parse_string ("style \"gnome-terminal-tab-close-button-style\"\n" |
2358 | + "{\n" |
2359 | + "GtkWidget::focus-padding = 0\n" |
2360 | + "GtkWidget::focus-line-width = 0\n" |
2361 | + "xthickness = 0\n" |
2362 | + "ythickness = 0\n" |
2363 | + "}\n" |
2364 | + "widget \"*.gnome-terminal-tab-close-button\" style \"gnome-terminal-tab-close-button-style\""); |
2365 | + |
2366 | + gtk_notebook_set_window_creation_hook (handle_tab_droped_on_desktop, NULL, NULL); |
2367 | +} |
2368 | + |
2369 | +static void |
2370 | +terminal_window_dispose (GObject *object) |
2371 | +{ |
2372 | + TerminalWindow *window = TERMINAL_WINDOW (object); |
2373 | + TerminalWindowPrivate *priv = window->priv; |
2374 | + TerminalApp *app; |
2375 | + GdkScreen *screen; |
2376 | + |
2377 | + remove_popup_info (window); |
2378 | + |
2379 | + priv->disposed = TRUE; |
2380 | + |
2381 | + if (priv->tabs_menu) |
2382 | + { |
2383 | + g_object_unref (priv->tabs_menu); |
2384 | + priv->tabs_menu = NULL; |
2385 | + } |
2386 | + |
2387 | + if (priv->profiles_action_group != NULL) |
2388 | + disconnect_profiles_from_actions_in_group (priv->profiles_action_group); |
2389 | + if (priv->new_terminal_action_group != NULL) |
2390 | + disconnect_profiles_from_actions_in_group (priv->new_terminal_action_group); |
2391 | + |
2392 | + app = terminal_app_get (); |
2393 | + g_signal_handlers_disconnect_by_func (app, |
2394 | + G_CALLBACK (terminal_window_profile_list_changed_cb), |
2395 | + window); |
2396 | + g_signal_handlers_disconnect_by_func (app, |
2397 | + G_CALLBACK (terminal_window_encoding_list_changed_cb), |
2398 | + window); |
2399 | + |
2400 | + screen = gtk_widget_get_screen (GTK_WIDGET (object)); |
2401 | + if (screen) |
2402 | + { |
2403 | + g_signal_handlers_disconnect_by_func (screen, |
2404 | + G_CALLBACK (terminal_window_window_manager_changed_cb), |
2405 | + window); |
2406 | +#ifdef GDK_WINDOWING_X11 |
2407 | + g_signal_handlers_disconnect_by_func (screen, |
2408 | + G_CALLBACK (terminal_window_composited_changed_cb), |
2409 | + window); |
2410 | +#endif |
2411 | + } |
2412 | + |
2413 | + G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object); |
2414 | +} |
2415 | + |
2416 | +static void |
2417 | +terminal_window_finalize (GObject *object) |
2418 | +{ |
2419 | + TerminalWindow *window = TERMINAL_WINDOW (object); |
2420 | + TerminalWindowPrivate *priv = window->priv; |
2421 | + |
2422 | + g_object_unref (priv->ui_manager); |
2423 | + |
2424 | + if (priv->confirm_close_dialog) |
2425 | + gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog), |
2426 | + GTK_RESPONSE_DELETE_EVENT); |
2427 | + |
2428 | + if (priv->search_find_dialog) |
2429 | + gtk_dialog_response (GTK_DIALOG (priv->search_find_dialog), |
2430 | + GTK_RESPONSE_DELETE_EVENT); |
2431 | + |
2432 | + G_OBJECT_CLASS (terminal_window_parent_class)->finalize (object); |
2433 | +} |
2434 | + |
2435 | +static gboolean |
2436 | +terminal_window_delete_event (GtkWidget *widget, |
2437 | + GdkEvent *event, |
2438 | + gpointer data) |
2439 | +{ |
2440 | + return confirm_close_window_or_tab (TERMINAL_WINDOW (widget), NULL); |
2441 | +} |
2442 | + |
2443 | +static void |
2444 | +terminal_window_show (GtkWidget *widget) |
2445 | +{ |
2446 | + TerminalWindow *window = TERMINAL_WINDOW (widget); |
2447 | + GtkAllocation widget_allocation; |
2448 | + |
2449 | + gtk_widget_get_allocation (widget, &widget_allocation); |
2450 | + |
2451 | +#if 0 |
2452 | + TerminalWindowPrivate *priv = window->priv; |
2453 | + |
2454 | + if (priv->active_screen != NULL) |
2455 | + { |
2456 | + /* At this point, we have our GdkScreen, and hence the right |
2457 | + * font size, so we can go ahead and size the window. */ |
2458 | + terminal_window_set_size (window, priv->active_screen, FALSE); |
2459 | + } |
2460 | +#endif |
2461 | + |
2462 | + terminal_window_update_geometry (window); |
2463 | + |
2464 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
2465 | + "[window %p] show, size %d : %d at (%d, %d)\n", |
2466 | + widget, |
2467 | + widget_allocation.width, widget_allocation.height, |
2468 | + widget_allocation.x, widget_allocation.y); |
2469 | + |
2470 | + GTK_WIDGET_CLASS (terminal_window_parent_class)->show (widget); |
2471 | +} |
2472 | + |
2473 | +TerminalWindow* |
2474 | +terminal_window_new (void) |
2475 | +{ |
2476 | + return g_object_new (TERMINAL_TYPE_WINDOW, NULL); |
2477 | +} |
2478 | + |
2479 | +/** |
2480 | + * terminal_window_set_is_restored: |
2481 | + * @window: |
2482 | + * |
2483 | + * Marks the window as restored from session. |
2484 | + */ |
2485 | +void |
2486 | +terminal_window_set_is_restored (TerminalWindow *window) |
2487 | +{ |
2488 | + g_return_if_fail (TERMINAL_IS_WINDOW (window)); |
2489 | + g_return_if_fail (!gtk_widget_get_mapped (GTK_WIDGET (window))); |
2490 | + |
2491 | + window->priv->clear_demands_attention = TRUE; |
2492 | +} |
2493 | + |
2494 | +static void |
2495 | +profile_set_callback (TerminalScreen *screen, |
2496 | + TerminalProfile *old_profile, |
2497 | + TerminalWindow *window) |
2498 | +{ |
2499 | + TerminalWindowPrivate *priv = window->priv; |
2500 | + |
2501 | + if (!gtk_widget_get_realized (GTK_WIDGET (window))) |
2502 | + return; |
2503 | + |
2504 | + if (screen != priv->active_screen) |
2505 | + return; |
2506 | + |
2507 | + terminal_window_update_set_profile_menu_active_profile (window); |
2508 | +} |
2509 | + |
2510 | +static void |
2511 | +sync_screen_title (TerminalScreen *screen, |
2512 | + GParamSpec *psepc, |
2513 | + TerminalWindow *window) |
2514 | +{ |
2515 | + TerminalWindowPrivate *priv = window->priv; |
2516 | + |
2517 | + if (screen != priv->active_screen) |
2518 | + return; |
2519 | + |
2520 | + gtk_window_set_title (GTK_WINDOW (window), terminal_screen_get_title (screen)); |
2521 | +} |
2522 | + |
2523 | +static void |
2524 | +sync_screen_icon_title (TerminalScreen *screen, |
2525 | + GParamSpec *psepc, |
2526 | + TerminalWindow *window) |
2527 | +{ |
2528 | + TerminalWindowPrivate *priv = window->priv; |
2529 | + |
2530 | + if (!gtk_widget_get_realized (GTK_WIDGET (window))) |
2531 | + return; |
2532 | + |
2533 | + if (screen != priv->active_screen) |
2534 | + return; |
2535 | + |
2536 | + if (!terminal_screen_get_icon_title_set (screen)) |
2537 | + return; |
2538 | + |
2539 | + gdk_window_set_icon_name (gtk_widget_get_window (GTK_WIDGET (window)), terminal_screen_get_icon_title (screen)); |
2540 | + |
2541 | + priv->icon_title_set = TRUE; |
2542 | +} |
2543 | + |
2544 | +static void |
2545 | +sync_screen_icon_title_set (TerminalScreen *screen, |
2546 | + GParamSpec *psepc, |
2547 | + TerminalWindow *window) |
2548 | +{ |
2549 | + TerminalWindowPrivate *priv = window->priv; |
2550 | + |
2551 | + if (!gtk_widget_get_realized (GTK_WIDGET (window))) |
2552 | + return; |
2553 | + |
2554 | + /* No need to restore the title if we never set an icon title */ |
2555 | + if (!priv->icon_title_set) |
2556 | + return; |
2557 | + |
2558 | + if (screen != priv->active_screen) |
2559 | + return; |
2560 | + |
2561 | + if (terminal_screen_get_icon_title_set (screen)) |
2562 | + return; |
2563 | + |
2564 | + /* Need to reset the icon name */ |
2565 | + /* FIXME: Once gtk+ bug 535557 is fixed, use that to unset the icon title. */ |
2566 | + |
2567 | + g_object_set_qdata (G_OBJECT (gtk_widget_get_window (GTK_WIDGET (window))), |
2568 | + g_quark_from_static_string ("gdk-icon-name-set"), |
2569 | + GUINT_TO_POINTER (FALSE)); |
2570 | + priv->icon_title_set = FALSE; |
2571 | + |
2572 | + /* Re-setting the right title will be done by the notify::title handler which comes after this one */ |
2573 | +} |
2574 | + |
2575 | +/* Notebook callbacks */ |
2576 | + |
2577 | +static void |
2578 | +close_button_clicked_cb (GtkWidget *tab_label, |
2579 | + GtkWidget *screen_container) |
2580 | +{ |
2581 | + GtkWidget *toplevel; |
2582 | + TerminalWindow *window; |
2583 | + TerminalWindowPrivate *priv; |
2584 | + TerminalScreen *screen; |
2585 | + |
2586 | + toplevel = gtk_widget_get_toplevel (screen_container); |
2587 | + if (!gtk_widget_is_toplevel (toplevel)) |
2588 | + return; |
2589 | + |
2590 | + if (!TERMINAL_IS_WINDOW (toplevel)) |
2591 | + return; |
2592 | + |
2593 | + window = TERMINAL_WINDOW (toplevel); |
2594 | + priv = window->priv; |
2595 | + |
2596 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (screen_container)); |
2597 | + if (confirm_close_window_or_tab (window, screen)) |
2598 | + return; |
2599 | + |
2600 | + terminal_window_remove_screen (window, screen); |
2601 | +} |
2602 | + |
2603 | +void |
2604 | +terminal_window_add_screen (TerminalWindow *window, |
2605 | + TerminalScreen *screen, |
2606 | + int position) |
2607 | +{ |
2608 | + TerminalWindowPrivate *priv = window->priv; |
2609 | + GtkWidget *old_window; |
2610 | + GtkWidget *screen_container, *tab_label; |
2611 | + |
2612 | + old_window = gtk_widget_get_toplevel (GTK_WIDGET (screen)); |
2613 | + if (gtk_widget_is_toplevel (old_window) && |
2614 | + TERMINAL_IS_WINDOW (old_window) && |
2615 | + TERMINAL_WINDOW (old_window)== window) |
2616 | + return; |
2617 | + |
2618 | + if (TERMINAL_IS_WINDOW (old_window)) |
2619 | + terminal_window_remove_screen (TERMINAL_WINDOW (old_window), screen); |
2620 | + |
2621 | + screen_container = terminal_screen_container_new (screen); |
2622 | + gtk_widget_show (screen_container); |
2623 | + |
2624 | + update_tab_visibility (window, +1); |
2625 | + |
2626 | + tab_label = terminal_tab_label_new (screen); |
2627 | + g_signal_connect (tab_label, "close-button-clicked", |
2628 | + G_CALLBACK (close_button_clicked_cb), screen_container); |
2629 | + |
2630 | + gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook), |
2631 | + screen_container, |
2632 | + tab_label, |
2633 | + position); |
2634 | + gtk_container_child_set (GTK_CONTAINER (priv->notebook), |
2635 | + screen_container, |
2636 | + "tab-expand", TRUE, |
2637 | + "tab-fill", TRUE, |
2638 | + NULL); |
2639 | + gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (priv->notebook), |
2640 | + screen_container, |
2641 | + TRUE); |
2642 | + gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (priv->notebook), |
2643 | + screen_container, |
2644 | + TRUE); |
2645 | +} |
2646 | + |
2647 | +void |
2648 | +terminal_window_remove_screen (TerminalWindow *window, |
2649 | + TerminalScreen *screen) |
2650 | +{ |
2651 | + TerminalWindowPrivate *priv = window->priv; |
2652 | + TerminalScreenContainer *screen_container; |
2653 | + |
2654 | + g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (window)); |
2655 | + |
2656 | + update_tab_visibility (window, -1); |
2657 | + |
2658 | + screen_container = terminal_screen_container_get_from_screen (screen); |
2659 | + gtk_container_remove (GTK_CONTAINER (priv->notebook), |
2660 | + GTK_WIDGET (screen_container)); |
2661 | +} |
2662 | + |
2663 | +void |
2664 | +terminal_window_move_screen (TerminalWindow *source_window, |
2665 | + TerminalWindow *dest_window, |
2666 | + TerminalScreen *screen, |
2667 | + int dest_position) |
2668 | +{ |
2669 | + TerminalScreenContainer *screen_container; |
2670 | + |
2671 | + g_return_if_fail (TERMINAL_IS_WINDOW (source_window)); |
2672 | + g_return_if_fail (TERMINAL_IS_WINDOW (dest_window)); |
2673 | + g_return_if_fail (TERMINAL_IS_SCREEN (screen)); |
2674 | + g_return_if_fail (gtk_widget_get_toplevel (GTK_WIDGET (screen)) == GTK_WIDGET (source_window)); |
2675 | + g_return_if_fail (dest_position >= -1); |
2676 | + |
2677 | + screen_container = terminal_screen_container_get_from_screen (screen); |
2678 | + g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container)); |
2679 | + |
2680 | + /* We have to ref the screen container as well as the screen, |
2681 | + * because otherwise removing the screen container from the source |
2682 | + * window's notebook will cause the container and its containing |
2683 | + * screen to be gtk_widget_destroy()ed! |
2684 | + */ |
2685 | + g_object_ref_sink (screen_container); |
2686 | + g_object_ref_sink (screen); |
2687 | + terminal_window_remove_screen (source_window, screen); |
2688 | + |
2689 | + /* Now we can safely remove the screen from the container and let the container die */ |
2690 | + gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (screen))), GTK_WIDGET (screen)); |
2691 | + g_object_unref (screen_container); |
2692 | + |
2693 | + terminal_window_add_screen (dest_window, screen, dest_position); |
2694 | + g_object_unref (screen); |
2695 | +} |
2696 | + |
2697 | +GList* |
2698 | +terminal_window_list_screen_containers (TerminalWindow *window) |
2699 | +{ |
2700 | + TerminalWindowPrivate *priv = window->priv; |
2701 | + |
2702 | + /* We are trusting that GtkNotebook will return pages in order */ |
2703 | + return gtk_container_get_children (GTK_CONTAINER (priv->notebook)); |
2704 | +} |
2705 | + |
2706 | +void |
2707 | +terminal_window_set_menubar_visible (TerminalWindow *window, |
2708 | + gboolean setting) |
2709 | +{ |
2710 | + TerminalWindowPrivate *priv = window->priv; |
2711 | + GtkAction *action; |
2712 | + |
2713 | + /* it's been set now, so don't override when adding a screen. |
2714 | + * this side effect must happen before we short-circuit below. |
2715 | + */ |
2716 | + priv->use_default_menubar_visibility = FALSE; |
2717 | + |
2718 | + if (setting == priv->menubar_visible) |
2719 | + return; |
2720 | + |
2721 | + priv->menubar_visible = setting; |
2722 | + |
2723 | + action = gtk_action_group_get_action (priv->action_group, "ViewMenubar"); |
2724 | + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), setting); |
2725 | + |
2726 | + g_object_set (priv->menubar, "visible", setting, NULL); |
2727 | + |
2728 | + /* FIXMEchpe: use gtk_widget_get_realized instead? */ |
2729 | + if (priv->active_screen) |
2730 | + { |
2731 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
2732 | + "[window %p] setting size after toggling menubar visibility\n", |
2733 | + window); |
2734 | + |
2735 | + terminal_window_set_size (window, priv->active_screen, TRUE); |
2736 | + } |
2737 | +} |
2738 | + |
2739 | +gboolean |
2740 | +terminal_window_get_menubar_visible (TerminalWindow *window) |
2741 | +{ |
2742 | + TerminalWindowPrivate *priv = window->priv; |
2743 | + |
2744 | + return priv->menubar_visible; |
2745 | +} |
2746 | + |
2747 | +GtkWidget * |
2748 | +terminal_window_get_notebook (TerminalWindow *window) |
2749 | +{ |
2750 | + TerminalWindowPrivate *priv = window->priv; |
2751 | + |
2752 | + g_return_val_if_fail (TERMINAL_IS_WINDOW (window), NULL); |
2753 | + |
2754 | + return GTK_WIDGET (priv->notebook); |
2755 | +} |
2756 | + |
2757 | +void |
2758 | +terminal_window_set_size (TerminalWindow *window, |
2759 | + TerminalScreen *screen, |
2760 | + gboolean even_if_mapped) |
2761 | +{ |
2762 | + terminal_window_set_size_force_grid (window, screen, even_if_mapped, -1, -1); |
2763 | +} |
2764 | + |
2765 | +void |
2766 | +terminal_window_set_size_force_grid (TerminalWindow *window, |
2767 | + TerminalScreen *screen, |
2768 | + gboolean even_if_mapped, |
2769 | + int force_grid_width, |
2770 | + int force_grid_height) |
2771 | +{ |
2772 | + /* Owen's hack from gnome-terminal */ |
2773 | + GtkWidget *widget; |
2774 | + GtkWidget *app; |
2775 | + GtkRequisition toplevel_request; |
2776 | + GtkRequisition widget_request; |
2777 | + int w, h; |
2778 | + int char_width; |
2779 | + int char_height; |
2780 | + int grid_width; |
2781 | + int grid_height; |
2782 | + GtkBorder *inner_border = NULL; |
2783 | + |
2784 | + /* be sure our geometry is up-to-date */ |
2785 | + terminal_window_update_geometry (window); |
2786 | + |
2787 | + widget = GTK_WIDGET (screen); |
2788 | + |
2789 | + app = gtk_widget_get_toplevel (widget); |
2790 | + g_assert (app != NULL); |
2791 | + |
2792 | + gtk_widget_size_request (app, &toplevel_request); |
2793 | + gtk_widget_size_request (widget, &widget_request); |
2794 | + |
2795 | + terminal_screen_get_cell_size (screen, &char_width, &char_height); |
2796 | + terminal_screen_get_size (screen, &grid_width, &grid_height); |
2797 | + |
2798 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
2799 | + "[window %p] set size: toplevel %dx%d widget %dx%d grid %dx%d char-cell %dx%d\n", |
2800 | + window, |
2801 | + toplevel_request.width, toplevel_request.height, |
2802 | + widget_request.width, widget_request.height, |
2803 | + grid_width, grid_height, char_width, char_height); |
2804 | + |
2805 | + w = toplevel_request.width - widget_request.width; |
2806 | + h = toplevel_request.height - widget_request.height; |
2807 | + |
2808 | + if (force_grid_width >= 0) |
2809 | + grid_width = force_grid_width; |
2810 | + if (force_grid_height >= 0) |
2811 | + grid_height = force_grid_height; |
2812 | + |
2813 | + gtk_widget_style_get (widget, "inner-border", &inner_border, NULL); |
2814 | + w += (inner_border ? (inner_border->left + inner_border->right) : 0) + char_width * grid_width; |
2815 | + h += (inner_border ? (inner_border->top + inner_border->bottom) : 0) + char_height * grid_height; |
2816 | + gtk_border_free (inner_border); |
2817 | + |
2818 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
2819 | + "[window %p] set size: grid %dx%d force %dx%d setting %dx%d pixels\n", |
2820 | + window, |
2821 | + grid_width, grid_height, force_grid_width, force_grid_height, w, h); |
2822 | + |
2823 | + if (even_if_mapped && gtk_widget_get_mapped (app)) { |
2824 | + gtk_window_resize (GTK_WINDOW (app), w, h); |
2825 | + } |
2826 | + else { |
2827 | + gtk_window_set_default_size (GTK_WINDOW (app), w, h); |
2828 | + } |
2829 | +} |
2830 | + |
2831 | +void |
2832 | +terminal_window_switch_screen (TerminalWindow *window, |
2833 | + TerminalScreen *screen) |
2834 | +{ |
2835 | + TerminalWindowPrivate *priv = window->priv; |
2836 | + TerminalScreenContainer *screen_container; |
2837 | + int page_num; |
2838 | + |
2839 | + screen_container = terminal_screen_container_get_from_screen (screen); |
2840 | + g_assert (TERMINAL_IS_SCREEN_CONTAINER (screen_container)); |
2841 | + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), |
2842 | + GTK_WIDGET (screen_container)); |
2843 | + gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), page_num); |
2844 | +} |
2845 | + |
2846 | +TerminalScreen* |
2847 | +terminal_window_get_active (TerminalWindow *window) |
2848 | +{ |
2849 | + TerminalWindowPrivate *priv = window->priv; |
2850 | + |
2851 | + return priv->active_screen; |
2852 | +} |
2853 | + |
2854 | +static gboolean |
2855 | +notebook_button_press_cb (GtkWidget *widget, |
2856 | + GdkEventButton *event, |
2857 | + TerminalWindow *window) |
2858 | +{ |
2859 | + TerminalWindowPrivate *priv = window->priv; |
2860 | + GtkNotebook *notebook = GTK_NOTEBOOK (widget); |
2861 | + GtkWidget *menu; |
2862 | + GtkAction *action; |
2863 | + int tab_clicked; |
2864 | + |
2865 | + if (event->type != GDK_BUTTON_PRESS || |
2866 | + event->button != 3 || |
2867 | + (event->state & gtk_accelerator_get_default_mod_mask ()) != 0) |
2868 | + return FALSE; |
2869 | + |
2870 | + tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root); |
2871 | + if (tab_clicked < 0) |
2872 | + return FALSE; |
2873 | + |
2874 | + /* switch to the page the mouse is over */ |
2875 | + gtk_notebook_set_current_page (notebook, tab_clicked); |
2876 | + |
2877 | + action = gtk_action_group_get_action (priv->action_group, "NotebookPopup"); |
2878 | + gtk_action_activate (action); |
2879 | + |
2880 | + menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup"); |
2881 | + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, |
2882 | + NULL, NULL, |
2883 | + event->button, event->time); |
2884 | + |
2885 | + return TRUE; |
2886 | +} |
2887 | + |
2888 | +static gboolean |
2889 | +notebook_popup_menu_cb (GtkWidget *widget, |
2890 | + TerminalWindow *window) |
2891 | +{ |
2892 | + TerminalWindowPrivate *priv = window->priv; |
2893 | + GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook); |
2894 | + GtkWidget *focus_widget, *tab, *tab_label, *menu; |
2895 | + GtkAction *action; |
2896 | + int page_num; |
2897 | + |
2898 | + focus_widget = gtk_window_get_focus (GTK_WINDOW (window)); |
2899 | + /* Only respond if the notebook is the actual focus */ |
2900 | + if (focus_widget != priv->notebook) |
2901 | + return FALSE; |
2902 | + |
2903 | + page_num = gtk_notebook_get_current_page (notebook); |
2904 | + tab = gtk_notebook_get_nth_page (notebook, page_num); |
2905 | + tab_label = gtk_notebook_get_tab_label (notebook, tab); |
2906 | + |
2907 | + action = gtk_action_group_get_action (priv->action_group, "NotebookPopup"); |
2908 | + gtk_action_activate (action); |
2909 | + |
2910 | + menu = gtk_ui_manager_get_widget (priv->ui_manager, "/NotebookPopup"); |
2911 | + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, |
2912 | + position_menu_under_widget, tab_label, |
2913 | + 0, gtk_get_current_event_time ()); |
2914 | + gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); |
2915 | + |
2916 | + return TRUE; |
2917 | +} |
2918 | + |
2919 | +static void |
2920 | +notebook_page_selected_callback (GtkWidget *notebook, |
2921 | +#if GTK_CHECK_VERSION (2, 90, 6) |
2922 | + GtkWidget *page_widget, |
2923 | +#else |
2924 | + gpointer useless_crap, |
2925 | +#endif |
2926 | + guint page_num, |
2927 | + TerminalWindow *window) |
2928 | +{ |
2929 | + TerminalWindowPrivate *priv = window->priv; |
2930 | + GtkWidget *widget; |
2931 | + TerminalScreen *screen; |
2932 | + TerminalProfile *profile; |
2933 | + int old_grid_width, old_grid_height; |
2934 | +#if !GTK_CHECK_VERSION (2, 90, 6) |
2935 | + GtkWidget *page_widget; |
2936 | +#endif |
2937 | + |
2938 | + _terminal_debug_print (TERMINAL_DEBUG_MDI, |
2939 | + "[window %p] MDI: page-selected %d\n", |
2940 | + window, page_num); |
2941 | + |
2942 | + if (priv->disposed) |
2943 | + return; |
2944 | + |
2945 | +#if !GTK_CHECK_VERSION (2, 90, 6) |
2946 | + page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num); |
2947 | +#endif |
2948 | + |
2949 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (page_widget)); |
2950 | + widget = GTK_WIDGET (screen); |
2951 | + g_assert (screen != NULL); |
2952 | + |
2953 | + _terminal_debug_print (TERMINAL_DEBUG_MDI, |
2954 | + "[window %p] MDI: setting active tab to screen %p (old active screen %p)\n", |
2955 | + window, screen, priv->active_screen); |
2956 | + |
2957 | + if (priv->active_screen == screen) |
2958 | + return; |
2959 | + |
2960 | + if (priv->active_screen != NULL) { |
2961 | + terminal_screen_get_size (priv->active_screen, &old_grid_width, &old_grid_height); |
2962 | + |
2963 | + /* This is so that we maintain the same grid */ |
2964 | + vte_terminal_set_size (VTE_TERMINAL (screen), old_grid_width, old_grid_height); |
2965 | + } |
2966 | + |
2967 | + /* Workaround to remove gtknotebook's feature of computing its size based on |
2968 | + * all pages. When the widget is hidden, its size will not be taken into |
2969 | + * account. |
2970 | + */ |
2971 | + if (priv->active_screen) |
2972 | + gtk_widget_hide (GTK_WIDGET (priv->active_screen)); /* FIXME */ |
2973 | + |
2974 | + /* Make sure that the widget is no longer hidden due to the workaround */ |
2975 | + gtk_widget_show (widget); |
2976 | + |
2977 | + profile = terminal_screen_get_profile (screen); |
2978 | + |
2979 | + priv->active_screen = screen; |
2980 | + |
2981 | + /* Override menubar setting if it wasn't restored from session */ |
2982 | + if (priv->use_default_menubar_visibility) |
2983 | + { |
2984 | + gboolean setting = |
2985 | + terminal_profile_get_property_boolean (terminal_screen_get_profile (screen), TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR); |
2986 | + |
2987 | + terminal_window_set_menubar_visible (window, setting); |
2988 | + } |
2989 | + |
2990 | + sync_screen_icon_title_set (screen, NULL, window); |
2991 | + sync_screen_icon_title (screen, NULL, window); |
2992 | + sync_screen_title (screen, NULL, window); |
2993 | + |
2994 | + /* set size of window to current grid size */ |
2995 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
2996 | + "[window %p] setting size after flipping notebook pages\n", |
2997 | + window); |
2998 | + terminal_window_set_size (window, screen, TRUE); |
2999 | + |
3000 | + terminal_window_update_tabs_menu_sensitivity (window); |
3001 | + terminal_window_update_encoding_menu_active_encoding (window); |
3002 | + terminal_window_update_set_profile_menu_active_profile (window); |
3003 | + terminal_window_update_copy_sensitivity (screen, window); |
3004 | + terminal_window_update_zoom_sensitivity (window); |
3005 | + terminal_window_update_search_sensitivity (screen, window); |
3006 | +} |
3007 | + |
3008 | +static void |
3009 | +notebook_page_added_callback (GtkWidget *notebook, |
3010 | + GtkWidget *container, |
3011 | + guint page_num, |
3012 | + TerminalWindow *window) |
3013 | +{ |
3014 | + TerminalWindowPrivate *priv = window->priv; |
3015 | + TerminalScreen *screen; |
3016 | + |
3017 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container)); |
3018 | + |
3019 | + _terminal_debug_print (TERMINAL_DEBUG_MDI, |
3020 | + "[window %p] MDI: screen %p inserted\n", |
3021 | + window, screen); |
3022 | + |
3023 | + g_signal_connect (G_OBJECT (screen), |
3024 | + "profile-set", |
3025 | + G_CALLBACK (profile_set_callback), |
3026 | + window); |
3027 | + |
3028 | + /* FIXME: only connect on the active screen, not all screens! */ |
3029 | + g_signal_connect (screen, "notify::title", |
3030 | + G_CALLBACK (sync_screen_title), window); |
3031 | + g_signal_connect (screen, "notify::icon-title", |
3032 | + G_CALLBACK (sync_screen_icon_title), window); |
3033 | + g_signal_connect (screen, "notify::icon-title-set", |
3034 | + G_CALLBACK (sync_screen_icon_title_set), window); |
3035 | + g_signal_connect (screen, "selection-changed", |
3036 | + G_CALLBACK (terminal_window_update_copy_sensitivity), window); |
3037 | + |
3038 | + g_signal_connect (screen, "show-popup-menu", |
3039 | + G_CALLBACK (screen_show_popup_menu_callback), window); |
3040 | + g_signal_connect (screen, "match-clicked", |
3041 | + G_CALLBACK (screen_match_clicked_cb), window); |
3042 | + g_signal_connect (screen, "resize-window", |
3043 | + G_CALLBACK (screen_resize_window_cb), window); |
3044 | + |
3045 | + g_signal_connect (screen, "close-screen", |
3046 | + G_CALLBACK (screen_close_cb), window); |
3047 | + |
3048 | + update_tab_visibility (window, 0); |
3049 | + terminal_window_update_tabs_menu_sensitivity (window); |
3050 | + terminal_window_update_search_sensitivity (screen, window); |
3051 | + |
3052 | +#if 0 |
3053 | + /* FIXMEchpe: wtf is this doing? */ |
3054 | + |
3055 | + /* If we have an active screen, match its size and zoom */ |
3056 | + if (priv->active_screen) |
3057 | + { |
3058 | + int current_width, current_height; |
3059 | + double scale; |
3060 | + |
3061 | + terminal_screen_get_size (priv->active_screen, ¤t_width, ¤t_height); |
3062 | + vte_terminal_set_size (VTE_TERMINAL (screen), current_width, current_height); |
3063 | + |
3064 | + scale = terminal_screen_get_font_scale (priv->active_screen); |
3065 | + terminal_screen_set_font_scale (screen, scale); |
3066 | + } |
3067 | +#endif |
3068 | + |
3069 | + if (priv->present_on_insert) |
3070 | + { |
3071 | + gtk_window_present_with_time (GTK_WINDOW (window), gtk_get_current_event_time ()); |
3072 | + priv->present_on_insert = FALSE; |
3073 | + } |
3074 | +} |
3075 | + |
3076 | +static void |
3077 | +notebook_page_removed_callback (GtkWidget *notebook, |
3078 | + GtkWidget *container, |
3079 | + guint page_num, |
3080 | + TerminalWindow *window) |
3081 | +{ |
3082 | + TerminalWindowPrivate *priv = window->priv; |
3083 | + TerminalScreen *screen; |
3084 | + int pages; |
3085 | + |
3086 | + if (priv->disposed) |
3087 | + return; |
3088 | + |
3089 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (container)); |
3090 | + |
3091 | + _terminal_debug_print (TERMINAL_DEBUG_MDI, |
3092 | + "[window %p] MDI: screen %p removed\n", |
3093 | + window, screen); |
3094 | + |
3095 | + g_signal_handlers_disconnect_by_func (G_OBJECT (screen), |
3096 | + G_CALLBACK (profile_set_callback), |
3097 | + window); |
3098 | + |
3099 | + g_signal_handlers_disconnect_by_func (G_OBJECT (screen), |
3100 | + G_CALLBACK (sync_screen_title), |
3101 | + window); |
3102 | + |
3103 | + g_signal_handlers_disconnect_by_func (G_OBJECT (screen), |
3104 | + G_CALLBACK (sync_screen_icon_title), |
3105 | + window); |
3106 | + |
3107 | + g_signal_handlers_disconnect_by_func (G_OBJECT (screen), |
3108 | + G_CALLBACK (sync_screen_icon_title_set), |
3109 | + window); |
3110 | + |
3111 | + g_signal_handlers_disconnect_by_func (G_OBJECT (screen), |
3112 | + G_CALLBACK (terminal_window_update_copy_sensitivity), |
3113 | + window); |
3114 | + |
3115 | + g_signal_handlers_disconnect_by_func (screen, |
3116 | + G_CALLBACK (screen_show_popup_menu_callback), |
3117 | + window); |
3118 | + |
3119 | + g_signal_handlers_disconnect_by_func (screen, |
3120 | + G_CALLBACK (screen_match_clicked_cb), |
3121 | + window); |
3122 | + g_signal_handlers_disconnect_by_func (screen, |
3123 | + G_CALLBACK (screen_resize_window_cb), |
3124 | + window); |
3125 | + |
3126 | + g_signal_handlers_disconnect_by_func (screen, |
3127 | + G_CALLBACK (screen_close_cb), |
3128 | + window); |
3129 | + |
3130 | + terminal_window_update_tabs_menu_sensitivity (window); |
3131 | + update_tab_visibility (window, 0); |
3132 | + terminal_window_update_search_sensitivity (screen, window); |
3133 | + |
3134 | + pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)); |
3135 | + if (pages == 1) |
3136 | + { |
3137 | + terminal_window_set_size (window, priv->active_screen, TRUE); |
3138 | + } |
3139 | + else if (pages == 0) |
3140 | + { |
3141 | + gtk_widget_destroy (GTK_WIDGET (window)); |
3142 | + } |
3143 | +} |
3144 | + |
3145 | +void |
3146 | +terminal_window_update_geometry (TerminalWindow *window) |
3147 | +{ |
3148 | + TerminalWindowPrivate *priv = window->priv; |
3149 | + GtkWidget *widget; |
3150 | + GdkGeometry hints; |
3151 | + int char_width; |
3152 | + int char_height; |
3153 | + |
3154 | + if (priv->active_screen == NULL) |
3155 | + return; |
3156 | + |
3157 | + widget = GTK_WIDGET (priv->active_screen); |
3158 | + |
3159 | + /* We set geometry hints from the active term; best thing |
3160 | + * I can think of to do. Other option would be to try to |
3161 | + * get some kind of union of all hints from all terms in the |
3162 | + * window, but that doesn't make too much sense. |
3163 | + */ |
3164 | + terminal_screen_get_cell_size (priv->active_screen, &char_width, &char_height); |
3165 | + |
3166 | + if (char_width != priv->old_char_width || |
3167 | + char_height != priv->old_char_height || |
3168 | + widget != (GtkWidget*) priv->old_geometry_widget) |
3169 | + { |
3170 | + GtkBorder *inner_border = NULL; |
3171 | + |
3172 | + /* FIXME Since we're using xthickness/ythickness to compute |
3173 | + * padding we need to change the hints when the theme changes. |
3174 | + */ |
3175 | + |
3176 | + gtk_widget_style_get (widget, "inner-border", &inner_border, NULL); |
3177 | + |
3178 | + hints.base_width = (inner_border ? (inner_border->left + inner_border->right) : 0); |
3179 | + hints.base_height = (inner_border ? (inner_border->top + inner_border->bottom) : 0); |
3180 | + |
3181 | + gtk_border_free (inner_border); |
3182 | + |
3183 | +#define MIN_WIDTH_CHARS 4 |
3184 | +#define MIN_HEIGHT_CHARS 1 |
3185 | + |
3186 | + hints.width_inc = char_width; |
3187 | + hints.height_inc = char_height; |
3188 | + |
3189 | + /* min size is min size of just the geometry widget, remember. */ |
3190 | + hints.min_width = hints.base_width + hints.width_inc * MIN_WIDTH_CHARS; |
3191 | + hints.min_height = hints.base_height + hints.height_inc * MIN_HEIGHT_CHARS; |
3192 | + |
3193 | + gtk_window_set_geometry_hints (GTK_WINDOW (window), |
3194 | + widget, |
3195 | + &hints, |
3196 | + GDK_HINT_RESIZE_INC | |
3197 | + GDK_HINT_MIN_SIZE | |
3198 | + GDK_HINT_BASE_SIZE); |
3199 | + |
3200 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
3201 | + "[window %p] hints: base %dx%d min %dx%d inc %d %d\n", |
3202 | + window, |
3203 | + hints.base_width, |
3204 | + hints.base_height, |
3205 | + hints.min_width, |
3206 | + hints.min_height, |
3207 | + hints.width_inc, |
3208 | + hints.height_inc); |
3209 | + |
3210 | + priv->old_char_width = hints.width_inc; |
3211 | + priv->old_char_height = hints.height_inc; |
3212 | + priv->old_geometry_widget = widget; |
3213 | + } |
3214 | + else |
3215 | + { |
3216 | + _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, |
3217 | + "[window %p] hints: increment unchanged, not setting\n", |
3218 | + window); |
3219 | + } |
3220 | +} |
3221 | + |
3222 | +static void |
3223 | +file_new_window_callback (GtkAction *action, |
3224 | + TerminalWindow *window) |
3225 | +{ |
3226 | + TerminalWindowPrivate *priv = window->priv; |
3227 | + TerminalApp *app; |
3228 | + TerminalWindow *new_window; |
3229 | + TerminalProfile *profile; |
3230 | + char *new_working_directory; |
3231 | + |
3232 | + app = terminal_app_get (); |
3233 | + |
3234 | + profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY); |
3235 | + if (!profile) |
3236 | + profile = terminal_screen_get_profile (priv->active_screen); |
3237 | + if (!profile) |
3238 | + profile = terminal_app_get_profile_for_new_term (app); |
3239 | + if (!profile) |
3240 | + return; |
3241 | + |
3242 | + if (_terminal_profile_get_forgotten (profile)) |
3243 | + return; |
3244 | + |
3245 | + new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window))); |
3246 | + |
3247 | + new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen); |
3248 | + terminal_app_new_terminal (app, new_window, profile, |
3249 | + NULL, NULL, |
3250 | + new_working_directory, |
3251 | + terminal_screen_get_initial_environment (priv->active_screen), |
3252 | + 1.0); |
3253 | + g_free (new_working_directory); |
3254 | + |
3255 | + gtk_window_present (GTK_WINDOW (new_window)); |
3256 | +} |
3257 | + |
3258 | +static void |
3259 | +file_new_tab_callback (GtkAction *action, |
3260 | + TerminalWindow *window) |
3261 | +{ |
3262 | + TerminalWindowPrivate *priv = window->priv; |
3263 | + TerminalApp *app; |
3264 | + TerminalProfile *profile; |
3265 | + char *new_working_directory; |
3266 | + |
3267 | + app = terminal_app_get (); |
3268 | + profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY); |
3269 | + if (!profile) |
3270 | + profile = terminal_screen_get_profile (priv->active_screen); |
3271 | + if (!profile) |
3272 | + profile = terminal_app_get_profile_for_new_term (app); |
3273 | + if (!profile) |
3274 | + return; |
3275 | + |
3276 | + if (_terminal_profile_get_forgotten (profile)) |
3277 | + return; |
3278 | + |
3279 | + new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen); |
3280 | + terminal_app_new_terminal (app, window, profile, |
3281 | + NULL, NULL, |
3282 | + new_working_directory, |
3283 | + terminal_screen_get_initial_environment (priv->active_screen), |
3284 | + 1.0); |
3285 | + g_free (new_working_directory); |
3286 | +} |
3287 | + |
3288 | +static void |
3289 | +confirm_close_response_cb (GtkWidget *dialog, |
3290 | + int response, |
3291 | + TerminalWindow *window) |
3292 | +{ |
3293 | + TerminalScreen *screen; |
3294 | + |
3295 | + screen = g_object_get_data (G_OBJECT (dialog), "close-screen"); |
3296 | + |
3297 | + gtk_widget_destroy (dialog); |
3298 | + |
3299 | + if (response != GTK_RESPONSE_ACCEPT) |
3300 | + return; |
3301 | + |
3302 | + if (screen) |
3303 | + terminal_window_remove_screen (window, screen); |
3304 | + else |
3305 | + gtk_widget_destroy (GTK_WIDGET (window)); |
3306 | +} |
3307 | + |
3308 | +/* Returns: TRUE if closing needs to wait until user confirmation; |
3309 | + * FALSE if the terminal or window can close immediately. |
3310 | + */ |
3311 | +static gboolean |
3312 | +confirm_close_window_or_tab (TerminalWindow *window, |
3313 | + TerminalScreen *screen) |
3314 | +{ |
3315 | + TerminalWindowPrivate *priv = window->priv; |
3316 | + GtkWidget *dialog; |
3317 | + GConfClient *client; |
3318 | + gboolean do_confirm; |
3319 | + int n_tabs; |
3320 | + |
3321 | + if (priv->confirm_close_dialog) |
3322 | + { |
3323 | + /* WTF, already have one? It's modal, so how did that happen? */ |
3324 | + gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog), |
3325 | + GTK_RESPONSE_DELETE_EVENT); |
3326 | + } |
3327 | + |
3328 | + client = gconf_client_get_default (); |
3329 | + do_confirm = gconf_client_get_bool (client, CONF_GLOBAL_PREFIX "/confirm_window_close", NULL); |
3330 | + g_object_unref (client); |
3331 | + if (!do_confirm) |
3332 | + return FALSE; |
3333 | + |
3334 | + if (screen) |
3335 | + { |
3336 | + do_confirm = terminal_screen_has_foreground_process (screen); |
3337 | + n_tabs = 1; |
3338 | + } |
3339 | + else |
3340 | + { |
3341 | + GList *tabs, *t; |
3342 | + |
3343 | + do_confirm = FALSE; |
3344 | + |
3345 | + tabs = terminal_window_list_screen_containers (window); |
3346 | + n_tabs = g_list_length (tabs); |
3347 | + |
3348 | + for (t = tabs; t != NULL; t = t->next) |
3349 | + { |
3350 | + TerminalScreen *terminal_screen; |
3351 | + |
3352 | + terminal_screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (t->data)); |
3353 | + if (terminal_screen_has_foreground_process (terminal_screen)) |
3354 | + { |
3355 | + do_confirm = TRUE; |
3356 | + break; |
3357 | + } |
3358 | + } |
3359 | + g_list_free (tabs); |
3360 | + } |
3361 | + |
3362 | + if (!do_confirm) |
3363 | + return FALSE; |
3364 | + |
3365 | + dialog = priv->confirm_close_dialog = |
3366 | + gtk_message_dialog_new (GTK_WINDOW (window), |
3367 | + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, |
3368 | + GTK_MESSAGE_WARNING, |
3369 | + GTK_BUTTONS_CANCEL, |
3370 | + "%s", n_tabs > 1 ? _("Close this window?") : _("Close this terminal?")); |
3371 | + |
3372 | + if (n_tabs > 1) |
3373 | + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), |
3374 | + "%s", _("There are still processes running in some terminals in this window. " |
3375 | + "Closing the window will kill all of them.")); |
3376 | + else |
3377 | + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), |
3378 | + "%s", _("There is still a process running in this terminal. " |
3379 | + "Closing the terminal will kill it.")); |
3380 | + |
3381 | + gtk_window_set_title (GTK_WINDOW (dialog), ""); |
3382 | + |
3383 | + gtk_dialog_add_button (GTK_DIALOG (dialog), n_tabs > 1 ? _("C_lose Window") : _("C_lose Terminal"), GTK_RESPONSE_ACCEPT); |
3384 | + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); |
3385 | + |
3386 | + gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), |
3387 | + GTK_RESPONSE_ACCEPT, |
3388 | + GTK_RESPONSE_CANCEL, |
3389 | + -1); |
3390 | + |
3391 | + g_object_set_data (G_OBJECT (dialog), "close-screen", screen); |
3392 | + |
3393 | + g_signal_connect (dialog, "destroy", |
3394 | + G_CALLBACK (gtk_widget_destroyed), &priv->confirm_close_dialog); |
3395 | + g_signal_connect (dialog, "response", |
3396 | + G_CALLBACK (confirm_close_response_cb), window); |
3397 | + |
3398 | + gtk_window_present (GTK_WINDOW (dialog)); |
3399 | + |
3400 | + return TRUE; |
3401 | +} |
3402 | + |
3403 | +static void |
3404 | +file_close_window_callback (GtkAction *action, |
3405 | + TerminalWindow *window) |
3406 | +{ |
3407 | + if (confirm_close_window_or_tab (window, NULL)) |
3408 | + return; |
3409 | + |
3410 | + gtk_widget_destroy (GTK_WIDGET (window)); |
3411 | +} |
3412 | + |
3413 | +#ifdef ENABLE_SAVE |
3414 | +static void |
3415 | +save_contents_dialog_on_response (GtkDialog *dialog, gint response_id, gpointer terminal) |
3416 | +{ |
3417 | + GtkWindow *parent; |
3418 | + gchar *filename_uri = NULL; |
3419 | + GFile *file; |
3420 | + GOutputStream *stream; |
3421 | + GError *error = NULL; |
3422 | + |
3423 | + if (response_id != GTK_RESPONSE_ACCEPT) |
3424 | + { |
3425 | + gtk_widget_destroy (GTK_WIDGET (dialog)); |
3426 | + return; |
3427 | + } |
3428 | + |
3429 | + parent = (GtkWindow*) gtk_widget_get_ancestor (GTK_WIDGET (terminal), GTK_TYPE_WINDOW); |
3430 | + filename_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog)); |
3431 | + |
3432 | + gtk_widget_destroy (GTK_WIDGET (dialog)); |
3433 | + |
3434 | + if (filename_uri == NULL) |
3435 | + return; |
3436 | + |
3437 | + file = g_file_new_for_uri (filename_uri); |
3438 | + stream = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error)); |
3439 | + |
3440 | + if (stream) |
3441 | + { |
3442 | + /* XXX |
3443 | + * FIXME |
3444 | + * This is a sync operation. |
3445 | + * Should be replaced with the async version when vte implements that. |
3446 | + */ |
3447 | + vte_terminal_write_contents (terminal, stream, |
3448 | + VTE_TERMINAL_WRITE_DEFAULT, |
3449 | + NULL, &error); |
3450 | + g_object_unref (stream); |
3451 | + } |
3452 | + |
3453 | + if (error) |
3454 | + { |
3455 | + terminal_util_show_error_dialog (parent, NULL, error, |
3456 | + "%s", _("Could not save contents")); |
3457 | + g_error_free (error); |
3458 | + } |
3459 | + |
3460 | + g_object_unref(file); |
3461 | + g_free(filename_uri); |
3462 | +} |
3463 | +#endif /* ENABLE_SAVE */ |
3464 | + |
3465 | +static void |
3466 | +file_save_contents_callback (GtkAction *action, |
3467 | + TerminalWindow *window) |
3468 | +{ |
3469 | +#ifdef ENABLE_SAVE |
3470 | + GtkWidget *dialog = NULL; |
3471 | + TerminalWindowPrivate *priv = window->priv; |
3472 | + VteTerminal *terminal; |
3473 | + |
3474 | + if (!priv->active_screen) |
3475 | + return; |
3476 | + |
3477 | + terminal = VTE_TERMINAL (priv->active_screen); |
3478 | + g_return_if_fail (VTE_IS_TERMINAL (terminal)); |
3479 | + |
3480 | + dialog = gtk_file_chooser_dialog_new (_("Save as..."), |
3481 | + GTK_WINDOW(window), |
3482 | + GTK_FILE_CHOOSER_ACTION_SAVE, |
3483 | + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
3484 | + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, |
3485 | + NULL); |
3486 | + |
3487 | + gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); |
3488 | + /* XXX where should we save to? */ |
3489 | + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)); |
3490 | + |
3491 | + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(window)); |
3492 | + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); |
3493 | + gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); |
3494 | + |
3495 | + g_signal_connect (dialog, "response", G_CALLBACK (save_contents_dialog_on_response), terminal); |
3496 | + g_signal_connect (dialog, "delete_event", G_CALLBACK (terminal_util_dialog_response_on_delete), NULL); |
3497 | + |
3498 | + gtk_window_present (GTK_WINDOW (dialog)); |
3499 | +#endif /* ENABLE_SAVE */ |
3500 | +} |
3501 | + |
3502 | +static void |
3503 | +file_close_tab_callback (GtkAction *action, |
3504 | + TerminalWindow *window) |
3505 | +{ |
3506 | + TerminalWindowPrivate *priv = window->priv; |
3507 | + TerminalScreen *active_screen = priv->active_screen; |
3508 | + |
3509 | + if (!active_screen) |
3510 | + return; |
3511 | + |
3512 | + if (confirm_close_window_or_tab (window, active_screen)) |
3513 | + return; |
3514 | + |
3515 | + terminal_window_remove_screen (window, active_screen); |
3516 | +} |
3517 | + |
3518 | +static void |
3519 | +edit_copy_callback (GtkAction *action, |
3520 | + TerminalWindow *window) |
3521 | +{ |
3522 | + TerminalWindowPrivate *priv = window->priv; |
3523 | + |
3524 | + if (!priv->active_screen) |
3525 | + return; |
3526 | + |
3527 | + vte_terminal_copy_clipboard (VTE_TERMINAL (priv->active_screen)); |
3528 | +} |
3529 | + |
3530 | +typedef struct { |
3531 | + TerminalScreen *screen; |
3532 | + gboolean uris_as_paths; |
3533 | +} PasteData; |
3534 | + |
3535 | +static void |
3536 | +clipboard_uris_received_cb (GtkClipboard *clipboard, |
3537 | + /* const */ char **uris, |
3538 | + PasteData *data) |
3539 | +{ |
3540 | + char *text; |
3541 | + gsize len; |
3542 | + |
3543 | + if (!uris) { |
3544 | + g_object_unref (data->screen); |
3545 | + g_slice_free (PasteData, data); |
3546 | + return; |
3547 | + } |
3548 | + |
3549 | + /* This potentially modifies the strings in |uris| but that's ok */ |
3550 | + if (data->uris_as_paths) |
3551 | + terminal_util_transform_uris_to_quoted_fuse_paths (uris); |
3552 | + |
3553 | + text = terminal_util_concat_uris (uris, &len); |
3554 | + vte_terminal_feed_child (VTE_TERMINAL (data->screen), text, len); |
3555 | + g_free (text); |
3556 | + |
3557 | + g_object_unref (data->screen); |
3558 | + g_slice_free (PasteData, data); |
3559 | +} |
3560 | + |
3561 | +static void |
3562 | +clipboard_targets_received_cb (GtkClipboard *clipboard, |
3563 | + GdkAtom *targets, |
3564 | + int n_targets, |
3565 | + PasteData *data) |
3566 | +{ |
3567 | + if (!targets) { |
3568 | + g_object_unref (data->screen); |
3569 | + g_slice_free (PasteData, data); |
3570 | + return; |
3571 | + } |
3572 | + |
3573 | + if (gtk_targets_include_uri (targets, n_targets)) { |
3574 | + gtk_clipboard_request_uris (clipboard, |
3575 | + (GtkClipboardURIReceivedFunc) clipboard_uris_received_cb, |
3576 | + data); |
3577 | + return; |
3578 | + } else /* if (gtk_targets_include_text (targets, n_targets)) */ { |
3579 | + vte_terminal_paste_clipboard (VTE_TERMINAL (data->screen)); |
3580 | + } |
3581 | + |
3582 | + g_object_unref (data->screen); |
3583 | + g_slice_free (PasteData, data); |
3584 | +} |
3585 | + |
3586 | +static void |
3587 | +edit_paste_callback (GtkAction *action, |
3588 | + TerminalWindow *window) |
3589 | +{ |
3590 | + TerminalWindowPrivate *priv = window->priv; |
3591 | + GtkClipboard *clipboard; |
3592 | + PasteData *data; |
3593 | + const char *name; |
3594 | + |
3595 | + if (!priv->active_screen) |
3596 | + return; |
3597 | + |
3598 | + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); |
3599 | + name = gtk_action_get_name (action); |
3600 | + |
3601 | + data = g_slice_new (PasteData); |
3602 | + data->screen = g_object_ref (priv->active_screen); |
3603 | + data->uris_as_paths = (name == I_("EditPasteURIPaths") || name == I_("PopupPasteURIPaths")); |
3604 | + |
3605 | + gtk_clipboard_request_targets (clipboard, |
3606 | + (GtkClipboardTargetsReceivedFunc) clipboard_targets_received_cb, |
3607 | + data); |
3608 | +} |
3609 | + |
3610 | +static void |
3611 | +edit_select_all_callback (GtkAction *action, |
3612 | + TerminalWindow *window) |
3613 | +{ |
3614 | + TerminalWindowPrivate *priv = window->priv; |
3615 | + |
3616 | + if (!priv->active_screen) |
3617 | + return; |
3618 | + |
3619 | + vte_terminal_select_all (VTE_TERMINAL (priv->active_screen)); |
3620 | +} |
3621 | + |
3622 | +static void |
3623 | +edit_keybindings_callback (GtkAction *action, |
3624 | + TerminalWindow *window) |
3625 | +{ |
3626 | + terminal_app_edit_keybindings (terminal_app_get (), |
3627 | + GTK_WINDOW (window)); |
3628 | +} |
3629 | + |
3630 | +static void |
3631 | +edit_current_profile_callback (GtkAction *action, |
3632 | + TerminalWindow *window) |
3633 | +{ |
3634 | + TerminalWindowPrivate *priv = window->priv; |
3635 | + |
3636 | + terminal_app_edit_profile (terminal_app_get (), |
3637 | + terminal_screen_get_profile (priv->active_screen), |
3638 | + GTK_WINDOW (window), |
3639 | + NULL); |
3640 | +} |
3641 | + |
3642 | +static void |
3643 | +file_new_profile_callback (GtkAction *action, |
3644 | + TerminalWindow *window) |
3645 | +{ |
3646 | + TerminalWindowPrivate *priv = window->priv; |
3647 | + |
3648 | + terminal_app_new_profile (terminal_app_get (), |
3649 | + terminal_screen_get_profile (priv->active_screen), |
3650 | + GTK_WINDOW (window)); |
3651 | +} |
3652 | + |
3653 | +static void |
3654 | +edit_profiles_callback (GtkAction *action, |
3655 | + TerminalWindow *window) |
3656 | +{ |
3657 | + terminal_app_manage_profiles (terminal_app_get (), |
3658 | + GTK_WINDOW (window)); |
3659 | +} |
3660 | + |
3661 | +static void |
3662 | +view_menubar_toggled_callback (GtkToggleAction *action, |
3663 | + TerminalWindow *window) |
3664 | +{ |
3665 | + terminal_window_set_menubar_visible (window, gtk_toggle_action_get_active (action)); |
3666 | +} |
3667 | + |
3668 | +static void |
3669 | +view_fullscreen_toggled_callback (GtkToggleAction *action, |
3670 | + TerminalWindow *window) |
3671 | +{ |
3672 | + g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (window))); |
3673 | + |
3674 | + if (gtk_toggle_action_get_active (action)) |
3675 | + gtk_window_fullscreen (GTK_WINDOW (window)); |
3676 | + else |
3677 | + gtk_window_unfullscreen (GTK_WINDOW (window)); |
3678 | +} |
3679 | + |
3680 | +static const double zoom_factors[] = { |
3681 | + TERMINAL_SCALE_MINIMUM, |
3682 | + TERMINAL_SCALE_XXXXX_SMALL, |
3683 | + TERMINAL_SCALE_XXXX_SMALL, |
3684 | + TERMINAL_SCALE_XXX_SMALL, |
3685 | + PANGO_SCALE_XX_SMALL, |
3686 | + PANGO_SCALE_X_SMALL, |
3687 | + PANGO_SCALE_SMALL, |
3688 | + PANGO_SCALE_MEDIUM, |
3689 | + PANGO_SCALE_LARGE, |
3690 | + PANGO_SCALE_X_LARGE, |
3691 | + PANGO_SCALE_XX_LARGE, |
3692 | + TERMINAL_SCALE_XXX_LARGE, |
3693 | + TERMINAL_SCALE_XXXX_LARGE, |
3694 | + TERMINAL_SCALE_XXXXX_LARGE, |
3695 | + TERMINAL_SCALE_MAXIMUM |
3696 | +}; |
3697 | + |
3698 | +static gboolean |
3699 | +find_larger_zoom_factor (double current, |
3700 | + double *found) |
3701 | +{ |
3702 | + guint i; |
3703 | + |
3704 | + for (i = 0; i < G_N_ELEMENTS (zoom_factors); ++i) |
3705 | + { |
3706 | + /* Find a font that's larger than this one */ |
3707 | + if ((zoom_factors[i] - current) > 1e-6) |
3708 | + { |
3709 | + *found = zoom_factors[i]; |
3710 | + return TRUE; |
3711 | + } |
3712 | + } |
3713 | + |
3714 | + return FALSE; |
3715 | +} |
3716 | + |
3717 | +static gboolean |
3718 | +find_smaller_zoom_factor (double current, |
3719 | + double *found) |
3720 | +{ |
3721 | + int i; |
3722 | + |
3723 | + i = (int) G_N_ELEMENTS (zoom_factors) - 1; |
3724 | + while (i >= 0) |
3725 | + { |
3726 | + /* Find a font that's smaller than this one */ |
3727 | + if ((current - zoom_factors[i]) > 1e-6) |
3728 | + { |
3729 | + *found = zoom_factors[i]; |
3730 | + return TRUE; |
3731 | + } |
3732 | + |
3733 | + --i; |
3734 | + } |
3735 | + |
3736 | + return FALSE; |
3737 | +} |
3738 | + |
3739 | +static void |
3740 | +view_zoom_in_callback (GtkAction *action, |
3741 | + TerminalWindow *window) |
3742 | +{ |
3743 | + TerminalWindowPrivate *priv = window->priv; |
3744 | + double current; |
3745 | + |
3746 | + if (priv->active_screen == NULL) |
3747 | + return; |
3748 | + |
3749 | + current = terminal_screen_get_font_scale (priv->active_screen); |
3750 | + if (!find_larger_zoom_factor (current, ¤t)) |
3751 | + return; |
3752 | + |
3753 | + terminal_screen_set_font_scale (priv->active_screen, current); |
3754 | + terminal_window_update_zoom_sensitivity (window); |
3755 | +} |
3756 | + |
3757 | +static void |
3758 | +view_zoom_out_callback (GtkAction *action, |
3759 | + TerminalWindow *window) |
3760 | +{ |
3761 | + TerminalWindowPrivate *priv = window->priv; |
3762 | + double current; |
3763 | + |
3764 | + if (priv->active_screen == NULL) |
3765 | + return; |
3766 | + |
3767 | + current = terminal_screen_get_font_scale (priv->active_screen); |
3768 | + if (!find_smaller_zoom_factor (current, ¤t)) |
3769 | + return; |
3770 | + |
3771 | + terminal_screen_set_font_scale (priv->active_screen, current); |
3772 | + terminal_window_update_zoom_sensitivity (window); |
3773 | +} |
3774 | + |
3775 | +static void |
3776 | +view_zoom_normal_callback (GtkAction *action, |
3777 | + TerminalWindow *window) |
3778 | +{ |
3779 | + TerminalWindowPrivate *priv = window->priv; |
3780 | + |
3781 | + if (priv->active_screen == NULL) |
3782 | + return; |
3783 | + |
3784 | + terminal_screen_set_font_scale (priv->active_screen, PANGO_SCALE_MEDIUM); |
3785 | + terminal_window_update_zoom_sensitivity (window); |
3786 | +} |
3787 | + |
3788 | + |
3789 | +static void |
3790 | +search_find_response_callback (GtkWidget *dialog, |
3791 | + int response, |
3792 | + gpointer user_data) |
3793 | +{ |
3794 | + TerminalWindow *window = TERMINAL_WINDOW (user_data); |
3795 | + TerminalWindowPrivate *priv = window->priv; |
3796 | + TerminalSearchFlags flags; |
3797 | + GRegex *regex; |
3798 | + |
3799 | + if (response != GTK_RESPONSE_ACCEPT) |
3800 | + return; |
3801 | + |
3802 | + if (G_UNLIKELY (!priv->active_screen)) |
3803 | + return; |
3804 | + |
3805 | + regex = terminal_search_dialog_get_regex (dialog); |
3806 | + g_return_if_fail (regex != NULL); |
3807 | + |
3808 | + flags = terminal_search_dialog_get_search_flags (dialog); |
3809 | + |
3810 | + vte_terminal_search_set_gregex (VTE_TERMINAL (priv->active_screen), regex); |
3811 | + vte_terminal_search_set_wrap_around (VTE_TERMINAL (priv->active_screen), |
3812 | + (flags & TERMINAL_SEARCH_FLAG_WRAP_AROUND)); |
3813 | + |
3814 | + if (flags & TERMINAL_SEARCH_FLAG_BACKWARDS) |
3815 | + vte_terminal_search_find_previous (VTE_TERMINAL (priv->active_screen)); |
3816 | + else |
3817 | + vte_terminal_search_find_next (VTE_TERMINAL (priv->active_screen)); |
3818 | + |
3819 | + terminal_window_update_search_sensitivity (priv->active_screen, window); |
3820 | +} |
3821 | + |
3822 | +static gboolean |
3823 | +search_dialog_delete_event_cb (GtkWidget *widget, |
3824 | + GdkEventAny *event, |
3825 | + gpointer user_data) |
3826 | +{ |
3827 | + /* prevent destruction */ |
3828 | + return TRUE; |
3829 | +} |
3830 | + |
3831 | +static void |
3832 | +search_find_callback (GtkAction *action, |
3833 | + TerminalWindow *window) |
3834 | +{ |
3835 | + TerminalWindowPrivate *priv = window->priv; |
3836 | + |
3837 | + if (!priv->search_find_dialog) { |
3838 | + GtkWidget *dialog; |
3839 | + |
3840 | + dialog = priv->search_find_dialog = terminal_search_dialog_new (GTK_WINDOW (window)); |
3841 | + |
3842 | + g_signal_connect (dialog, "destroy", |
3843 | + G_CALLBACK (gtk_widget_destroyed), &priv->search_find_dialog); |
3844 | + g_signal_connect (dialog, "response", |
3845 | + G_CALLBACK (search_find_response_callback), window); |
3846 | + g_signal_connect (dialog, "delete-event", |
3847 | + G_CALLBACK (search_dialog_delete_event_cb), NULL); |
3848 | + } |
3849 | + |
3850 | + terminal_search_dialog_present (priv->search_find_dialog); |
3851 | +} |
3852 | + |
3853 | +static void |
3854 | +search_find_next_callback (GtkAction *action, |
3855 | + TerminalWindow *window) |
3856 | +{ |
3857 | + if (G_UNLIKELY (!window->priv->active_screen)) |
3858 | + return; |
3859 | + |
3860 | + vte_terminal_search_find_next (VTE_TERMINAL (window->priv->active_screen)); |
3861 | +} |
3862 | + |
3863 | +static void |
3864 | +search_find_prev_callback (GtkAction *action, |
3865 | + TerminalWindow *window) |
3866 | +{ |
3867 | + if (G_UNLIKELY (!window->priv->active_screen)) |
3868 | + return; |
3869 | + |
3870 | + vte_terminal_search_find_previous (VTE_TERMINAL (window->priv->active_screen)); |
3871 | +} |
3872 | + |
3873 | +static void |
3874 | +search_clear_highlight_callback (GtkAction *action, |
3875 | + TerminalWindow *window) |
3876 | +{ |
3877 | + if (G_UNLIKELY (!window->priv->active_screen)) |
3878 | + return; |
3879 | + |
3880 | + vte_terminal_search_set_gregex (VTE_TERMINAL (window->priv->active_screen), NULL); |
3881 | +} |
3882 | + |
3883 | +static void |
3884 | +terminal_set_title_dialog_response_cb (GtkWidget *dialog, |
3885 | + int response, |
3886 | + TerminalScreen *screen) |
3887 | +{ |
3888 | + if (response == GTK_RESPONSE_OK) |
3889 | + { |
3890 | + GtkEntry *entry; |
3891 | + const char *text; |
3892 | + |
3893 | + entry = GTK_ENTRY (g_object_get_data (G_OBJECT (dialog), "title-entry")); |
3894 | + text = gtk_entry_get_text (entry); |
3895 | + terminal_screen_set_user_title (screen, text); |
3896 | + } |
3897 | + |
3898 | + gtk_widget_destroy (dialog); |
3899 | +} |
3900 | + |
3901 | +static void |
3902 | +terminal_set_title_callback (GtkAction *action, |
3903 | + TerminalWindow *window) |
3904 | +{ |
3905 | + TerminalWindowPrivate *priv = window->priv; |
3906 | + GtkWidget *dialog, *message_area, *hbox, *label, *entry; |
3907 | + |
3908 | + if (priv->active_screen == NULL) |
3909 | + return; |
3910 | + |
3911 | + /* FIXME: hook the screen up so this dialogue closes if the terminal screen closes */ |
3912 | + |
3913 | + dialog = gtk_message_dialog_new (GTK_WINDOW (window), |
3914 | + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, |
3915 | + GTK_MESSAGE_OTHER, |
3916 | + GTK_BUTTONS_OK_CANCEL, |
3917 | + "%s", ""); |
3918 | + |
3919 | + gtk_window_set_title (GTK_WINDOW (dialog), _("Set Title")); |
3920 | + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); |
3921 | + gtk_window_set_role (GTK_WINDOW (dialog), "gnome-terminal-change-title"); |
3922 | + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); |
3923 | + /* Alternative button order was set automatically by GtkMessageDialog */ |
3924 | + |
3925 | + g_signal_connect (dialog, "response", |
3926 | + G_CALLBACK (terminal_set_title_dialog_response_cb), priv->active_screen); |
3927 | + g_signal_connect (dialog, "delete-event", |
3928 | + G_CALLBACK (terminal_util_dialog_response_on_delete), NULL); |
3929 | + |
3930 | +#if GTK_CHECK_VERSION (2, 90, 6) |
3931 | + message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog)); |
3932 | + gtk_container_foreach (GTK_CONTAINER (message_area), (GtkCallback) gtk_widget_hide, NULL); |
3933 | +#else |
3934 | + label = GTK_MESSAGE_DIALOG (dialog)->label; |
3935 | + gtk_widget_hide (label); |
3936 | + message_area = gtk_widget_get_parent (label); |
3937 | +#endif |
3938 | + |
3939 | + hbox = gtk_hbox_new (FALSE, 12); |
3940 | + gtk_box_pack_start (GTK_BOX (message_area), hbox, FALSE, FALSE, 0); |
3941 | + |
3942 | + label = gtk_label_new_with_mnemonic (_("_Title:")); |
3943 | + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); |
3944 | + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
3945 | + |
3946 | + entry = gtk_entry_new (); |
3947 | + gtk_entry_set_width_chars (GTK_ENTRY (entry), 32); |
3948 | + gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); |
3949 | + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); |
3950 | + gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); |
3951 | + gtk_widget_show_all (hbox); |
3952 | + |
3953 | + gtk_widget_grab_focus (entry); |
3954 | + gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen)); |
3955 | + gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); |
3956 | + g_object_set_data (G_OBJECT (dialog), "title-entry", entry); |
3957 | + |
3958 | + gtk_window_present (GTK_WINDOW (dialog)); |
3959 | +} |
3960 | + |
3961 | +static void |
3962 | +terminal_add_encoding_callback (GtkAction *action, |
3963 | + TerminalWindow *window) |
3964 | +{ |
3965 | + terminal_app_edit_encodings (terminal_app_get (), |
3966 | + GTK_WINDOW (window)); |
3967 | +} |
3968 | + |
3969 | +static void |
3970 | +terminal_reset_callback (GtkAction *action, |
3971 | + TerminalWindow *window) |
3972 | +{ |
3973 | + TerminalWindowPrivate *priv = window->priv; |
3974 | + |
3975 | + if (priv->active_screen == NULL) |
3976 | + return; |
3977 | + |
3978 | + vte_terminal_reset (VTE_TERMINAL (priv->active_screen), TRUE, FALSE); |
3979 | +} |
3980 | + |
3981 | +static void |
3982 | +terminal_reset_clear_callback (GtkAction *action, |
3983 | + TerminalWindow *window) |
3984 | +{ |
3985 | + TerminalWindowPrivate *priv = window->priv; |
3986 | + |
3987 | + if (priv->active_screen == NULL) |
3988 | + return; |
3989 | + |
3990 | + vte_terminal_reset (VTE_TERMINAL (priv->active_screen), TRUE, TRUE); |
3991 | +} |
3992 | + |
3993 | +static void |
3994 | +tabs_next_or_previous_tab_cb (GtkAction *action, |
3995 | + TerminalWindow *window) |
3996 | +{ |
3997 | + TerminalWindowPrivate *priv = window->priv; |
3998 | + GtkNotebookClass *klass; |
3999 | + GtkBindingSet *binding_set; |
4000 | + const char *name; |
4001 | + guint keyval = 0; |
4002 | + |
4003 | + name = gtk_action_get_name (action); |
4004 | + if (strcmp (name, "TabsNext") == 0) { |
4005 | + keyval = GDK_Page_Down; |
4006 | + } else if (strcmp (name, "TabsPrevious") == 0) { |
4007 | + keyval = GDK_Page_Up; |
4008 | + } |
4009 | + |
4010 | + klass = GTK_NOTEBOOK_GET_CLASS (GTK_NOTEBOOK (priv->notebook)); |
4011 | + binding_set = gtk_binding_set_by_class (klass); |
4012 | + gtk_binding_set_activate (gtk_binding_set_by_class (klass), |
4013 | + keyval, |
4014 | + GDK_CONTROL_MASK, |
4015 | + GTK_OBJECT (priv->notebook)); |
4016 | +} |
4017 | + |
4018 | +static void |
4019 | +tabs_move_left_callback (GtkAction *action, |
4020 | + TerminalWindow *window) |
4021 | +{ |
4022 | + TerminalWindowPrivate *priv = window->priv; |
4023 | + GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook); |
4024 | + gint page_num,last_page; |
4025 | + GtkWidget *page; |
4026 | + |
4027 | + page_num = gtk_notebook_get_current_page (notebook); |
4028 | + last_page = gtk_notebook_get_n_pages (notebook) - 1; |
4029 | + page = gtk_notebook_get_nth_page (notebook, page_num); |
4030 | + |
4031 | + gtk_notebook_reorder_child (notebook, page, page_num == 0 ? last_page : page_num - 1); |
4032 | +} |
4033 | + |
4034 | +static void |
4035 | +tabs_move_right_callback (GtkAction *action, |
4036 | + TerminalWindow *window) |
4037 | +{ |
4038 | + TerminalWindowPrivate *priv = window->priv; |
4039 | + GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook); |
4040 | + gint page_num,last_page; |
4041 | + GtkWidget *page; |
4042 | + |
4043 | + page_num = gtk_notebook_get_current_page (notebook); |
4044 | + last_page = gtk_notebook_get_n_pages (notebook) - 1; |
4045 | + page = gtk_notebook_get_nth_page (notebook, page_num); |
4046 | + |
4047 | + gtk_notebook_reorder_child (notebook, page, page_num == last_page ? 0 : page_num + 1); |
4048 | +} |
4049 | + |
4050 | +static void |
4051 | +tabs_detach_tab_callback (GtkAction *action, |
4052 | + TerminalWindow *window) |
4053 | +{ |
4054 | + TerminalWindowPrivate *priv = window->priv; |
4055 | + TerminalApp *app; |
4056 | + TerminalWindow *new_window; |
4057 | + TerminalScreen *screen; |
4058 | + char *geometry; |
4059 | + int width, height; |
4060 | + |
4061 | + app = terminal_app_get (); |
4062 | + |
4063 | + screen = priv->active_screen; |
4064 | + |
4065 | + /* FIXME: this seems wrong if tabs are shown in the window */ |
4066 | + terminal_screen_get_size (screen, &width, &height); |
4067 | + geometry = g_strdup_printf ("%dx%d", width, height); |
4068 | + |
4069 | + new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window))); |
4070 | + |
4071 | + terminal_window_move_screen (window, new_window, screen, -1); |
4072 | + |
4073 | + gtk_window_parse_geometry (GTK_WINDOW (new_window), geometry); |
4074 | + g_free (geometry); |
4075 | + |
4076 | + gtk_window_present_with_time (GTK_WINDOW (new_window), gtk_get_current_event_time ()); |
4077 | +} |
4078 | + |
4079 | +static void |
4080 | +help_contents_callback (GtkAction *action, |
4081 | + TerminalWindow *window) |
4082 | +{ |
4083 | + terminal_util_show_help (NULL, GTK_WINDOW (window)); |
4084 | +} |
4085 | + |
4086 | +#define ABOUT_GROUP "About" |
4087 | +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) |
4088 | + |
4089 | +static void |
4090 | +help_about_callback (GtkAction *action, |
4091 | + TerminalWindow *window) |
4092 | +{ |
4093 | + static const char copyright[] = |
4094 | + "Copyright © 2002–2004 Havoc Pennington\n" |
4095 | + "Copyright © 2003–2004, 2007 Mariano Suárez-Alvarez\n" |
4096 | + "Copyright © 2006 Guilherme de S. Pastore\n" |
4097 | + "Copyright © 2007–2010 Christian Persch"; |
4098 | + char *licence_text; |
4099 | + GKeyFile *key_file; |
4100 | + GError *error = NULL; |
4101 | + char **authors, **contributors, **artists, **documenters, **array_strv; |
4102 | + gsize n_authors = 0, n_contributors = 0, n_artists = 0, n_documenters = 0 , i; |
4103 | + GPtrArray *array; |
4104 | + |
4105 | + key_file = g_key_file_new (); |
4106 | + if (!g_key_file_load_from_file (key_file, TERM_PKGDATADIR G_DIR_SEPARATOR_S "terminal.about", 0, &error)) |
4107 | + { |
4108 | + g_warning ("Couldn't load about data: %s\n", error->message); |
4109 | + g_error_free (error); |
4110 | + g_key_file_free (key_file); |
4111 | + return; |
4112 | + } |
4113 | + |
4114 | + authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL); |
4115 | + contributors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Contributors", &n_contributors, NULL); |
4116 | + artists = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Artists", &n_artists, NULL); |
4117 | + documenters = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Documenters", &n_documenters, NULL); |
4118 | + g_key_file_free (key_file); |
4119 | + |
4120 | + array = g_ptr_array_new (); |
4121 | + |
4122 | + for (i = 0; i < n_authors; ++i) |
4123 | + g_ptr_array_add (array, EMAILIFY (authors[i])); |
4124 | + g_free (authors); /* strings are now owned by the array */ |
4125 | + |
4126 | + if (n_contributors > 0) |
4127 | + { |
4128 | + g_ptr_array_add (array, g_strdup ("")); |
4129 | + g_ptr_array_add (array, g_strdup (_("Contributors:"))); |
4130 | + for (i = 0; i < n_contributors; ++i) |
4131 | + g_ptr_array_add (array, EMAILIFY (contributors[i])); |
4132 | + } |
4133 | + g_free (contributors); /* strings are now owned by the array */ |
4134 | + |
4135 | + g_ptr_array_add (array, NULL); |
4136 | + array_strv = (char **) g_ptr_array_free (array, FALSE); |
4137 | + |
4138 | + for (i = 0; i < n_artists; ++i) |
4139 | + artists[i] = EMAILIFY (artists[i]); |
4140 | + for (i = 0; i < n_documenters; ++i) |
4141 | + documenters[i] = EMAILIFY (documenters[i]); |
4142 | + |
4143 | + licence_text = terminal_util_get_licence_text (); |
4144 | + |
4145 | + gtk_show_about_dialog (GTK_WINDOW (window), |
4146 | + "program-name", _("GNOME Terminal"), |
4147 | + "copyright", copyright, |
4148 | + "comments", _("A terminal emulator for the GNOME desktop"), |
4149 | + "version", VERSION, |
4150 | + "authors", array_strv, |
4151 | + "artists", artists, |
4152 | + "documenters", documenters, |
4153 | + "license", licence_text, |
4154 | + "wrap-license", TRUE, |
4155 | + "translator-credits", _("translator-credits"), |
4156 | + "logo-icon-name", GNOME_TERMINAL_ICON_NAME, |
4157 | + NULL); |
4158 | + |
4159 | + g_strfreev (array_strv); |
4160 | + g_strfreev (artists); |
4161 | + g_strfreev (documenters); |
4162 | + g_free (licence_text); |
4163 | +} |
4164 | + |
4165 | +GtkUIManager * |
4166 | +terminal_window_get_ui_manager (TerminalWindow *window) |
4167 | +{ |
4168 | + TerminalWindowPrivate *priv = window->priv; |
4169 | + |
4170 | + return priv->ui_manager; |
4171 | +} |
4172 | + |
4173 | +void |
4174 | +terminal_window_save_state (TerminalWindow *window, |
4175 | + GKeyFile *key_file, |
4176 | + const char *group) |
4177 | +{ |
4178 | + TerminalWindowPrivate *priv = window->priv; |
4179 | + GList *tabs, *lt; |
4180 | + TerminalScreen *active_screen; |
4181 | + GdkWindowState state; |
4182 | + GPtrArray *tab_names_array; |
4183 | + char **tab_names; |
4184 | + gsize len; |
4185 | + |
4186 | + //XXXif (priv->menub)//XXX |
4187 | + g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_MENUBAR_VISIBLE, |
4188 | + priv->menubar_visible); |
4189 | + |
4190 | + g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ROLE, |
4191 | + gtk_window_get_role (GTK_WINDOW (window))); |
4192 | + |
4193 | + state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window))); |
4194 | + if (state & GDK_WINDOW_STATE_MAXIMIZED) |
4195 | + g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED, TRUE); |
4196 | + if (state & GDK_WINDOW_STATE_FULLSCREEN) |
4197 | + g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, TRUE); |
4198 | + |
4199 | + active_screen = terminal_window_get_active (window); |
4200 | + tabs = terminal_window_list_screen_containers (window); |
4201 | + |
4202 | + tab_names_array = g_ptr_array_sized_new (g_list_length (tabs) + 1); |
4203 | + |
4204 | + for (lt = tabs; lt != NULL; lt = lt->next) |
4205 | + { |
4206 | + TerminalScreen *screen; |
4207 | + char *tab_group; |
4208 | + |
4209 | + screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (lt->data)); |
4210 | + |
4211 | + tab_group = g_strdup_printf ("Terminal%p", screen); |
4212 | + g_ptr_array_add (tab_names_array, tab_group); |
4213 | + |
4214 | + terminal_screen_save_config (screen, key_file, tab_group); |
4215 | + |
4216 | + if (screen == active_screen) |
4217 | + { |
4218 | + int w, h, x, y; |
4219 | + char *geometry; |
4220 | + |
4221 | + g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB, tab_group); |
4222 | + |
4223 | + /* FIXME saving the geometry is not great :-/ */ |
4224 | + terminal_screen_get_size (screen, &w, &h); |
4225 | + gtk_window_get_position (GTK_WINDOW (window), &x, &y); |
4226 | + geometry = g_strdup_printf ("%dx%d+%d+%d", w, h, x, y); |
4227 | + g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY, geometry); |
4228 | + g_free (geometry); |
4229 | + } |
4230 | + } |
4231 | + |
4232 | + g_list_free (tabs); |
4233 | + |
4234 | + len = tab_names_array->len; |
4235 | + g_ptr_array_add (tab_names_array, NULL); |
4236 | + tab_names = (char **) g_ptr_array_free (tab_names_array, FALSE); |
4237 | + g_key_file_set_string_list (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_TABS, (const char * const *) tab_names, len); |
4238 | + g_strfreev (tab_names); |
4239 | +} |
4240 | |
4241 | === added file '.pc/01_lpi.patch/src/terminal.xml' |
4242 | --- .pc/01_lpi.patch/src/terminal.xml 1970-01-01 00:00:00 +0000 |
4243 | +++ .pc/01_lpi.patch/src/terminal.xml 2011-05-27 08:11:08 +0000 |
4244 | @@ -0,0 +1,116 @@ |
4245 | +<ui> |
4246 | + <menubar> |
4247 | + <menu action="File"> |
4248 | + <menuitem action="FileNewWindow" /> |
4249 | + <menu action="FileNewWindowProfiles" /> |
4250 | + <menuitem action="FileNewTab" /> |
4251 | + <menu action="FileNewTabProfiles" /> |
4252 | + <separator /> |
4253 | + <menuitem action="FileNewProfile" /> |
4254 | + <menuitem action="FileSaveContents" /> |
4255 | + <separator /> |
4256 | + <menuitem action="FileCloseTab" /> |
4257 | + <menuitem action="FileCloseWindow" /> |
4258 | + </menu> |
4259 | + <menu action="Edit"> |
4260 | + <menuitem action="EditCopy" /> |
4261 | + <menuitem action="EditPaste" /> |
4262 | + <menuitem action="EditPasteURIPaths" /> |
4263 | + <separator /> |
4264 | + <menuitem action="EditSelectAll" /> |
4265 | + <separator /> |
4266 | + <menuitem action="EditProfiles" /> |
4267 | + <menuitem action="EditKeybindings" /> |
4268 | + <menuitem action="EditCurrentProfile" /> |
4269 | + </menu> |
4270 | + <menu action="View"> |
4271 | + <menuitem action="ViewMenubar" /> |
4272 | + <menuitem action="ViewFullscreen" /> |
4273 | + <separator /> |
4274 | + <menuitem action="ViewZoomIn" /> |
4275 | + <menuitem action="ViewZoomOut" /> |
4276 | + <menuitem action="ViewZoom100" /> |
4277 | + </menu> |
4278 | + <menu action="Search"> |
4279 | + <menuitem action="SearchFind"/> |
4280 | + <menuitem action="SearchFindNext"/> |
4281 | + <menuitem action="SearchFindPrevious"/> |
4282 | + <!-- |
4283 | + <menuitem action="SearchIncrementalSearch"/> |
4284 | + --> |
4285 | + <!-- |
4286 | + <separator/> |
4287 | + <menuitem name="SearchClearHighlight" action="SearchClearHighlight"/> |
4288 | + --> |
4289 | + <!-- |
4290 | + <separator/> |
4291 | + <menuitem name="SearchGoToLineMenu" action="SearchGoToLine"/> |
4292 | + --> |
4293 | + </menu> |
4294 | + <menu action="Terminal"> |
4295 | + <menu action="TerminalProfiles" /> |
4296 | + <menuitem action="TerminalSetTitle" /> |
4297 | + <menu action="TerminalSetEncoding" > |
4298 | + <placeholder name="EncodingsPH" /> |
4299 | + <separator /> |
4300 | + <menuitem action="TerminalAddEncoding" /> |
4301 | + </menu> |
4302 | + <separator /> |
4303 | + <menuitem action="TerminalReset" /> |
4304 | + <menuitem action="TerminalResetClear" /> |
4305 | + <separator /> |
4306 | + <placeholder name="TerminalSizeToPH" /> |
4307 | + </menu> |
4308 | + <menu action="Tabs"> |
4309 | + <menuitem action="TabsNext" /> |
4310 | + <menuitem action="TabsPrevious" /> |
4311 | + <separator /> |
4312 | + <menuitem action="TabsMoveLeft" /> |
4313 | + <menuitem action="TabsMoveRight" /> |
4314 | + <separator /> |
4315 | + <menuitem action="TabsDetach" /> |
4316 | + <separator /> |
4317 | + </menu> |
4318 | + <menu action="Help"> |
4319 | + <menuitem action="HelpContents" /> |
4320 | + <menuitem action="HelpAbout" /> |
4321 | + </menu> |
4322 | + </menubar> |
4323 | + |
4324 | + <popup name="Popup" action="Popup"> |
4325 | + <menuitem action="PopupSendEmail" /> |
4326 | + <menuitem action="PopupCopyEmailAddress" /> |
4327 | + <menuitem action="PopupCall" /> |
4328 | + <menuitem action="PopupCopyCallAddress" /> |
4329 | + <menuitem action="PopupOpenLink" /> |
4330 | + <menuitem action="PopupCopyLinkAddress" /> |
4331 | + <separator /> |
4332 | + <menuitem action="PopupNewTerminal" /> |
4333 | + <menuitem action="PopupNewTab" /> |
4334 | + <separator /> |
4335 | + <menuitem action="PopupCloseTab" /> |
4336 | + <menuitem action="PopupCloseWindow" /> |
4337 | + <separator /> |
4338 | + <menuitem action="PopupCopy" /> |
4339 | + <menuitem action="PopupPaste" /> |
4340 | + <menuitem action="PopupPasteURIPaths" /> |
4341 | + <separator /> |
4342 | + <menu action="PopupTerminalProfiles"> |
4343 | + <placeholder name="ProfilesPH" /> |
4344 | + <separator /> |
4345 | + <menuitem action="EditCurrentProfile" /> |
4346 | + </menu> |
4347 | + <menuitem action="ViewMenubar" /> |
4348 | + <menuitem action="PopupLeaveFullscreen" /> |
4349 | + <separator /> |
4350 | + <menuitem action="PopupInputMethods" /> |
4351 | + </popup> |
4352 | + <popup name="NotebookPopup" action="NotebookPopup"> |
4353 | + <menuitem action="TabsMoveLeft"/> |
4354 | + <menuitem action="TabsMoveRight"/> |
4355 | + <separator /> |
4356 | + <menuitem action="TerminalSetTitle" /> |
4357 | + <separator /> |
4358 | + <menuitem action="FileCloseTab"/> |
4359 | + </popup> |
4360 | +</ui> |
4361 | |
4362 | === added directory '.pc/01_onlyshowin.patch' |
4363 | === added file '.pc/01_onlyshowin.patch/gnome-terminal.desktop.in.in' |
4364 | --- .pc/01_onlyshowin.patch/gnome-terminal.desktop.in.in 1970-01-01 00:00:00 +0000 |
4365 | +++ .pc/01_onlyshowin.patch/gnome-terminal.desktop.in.in 2011-05-27 08:11:08 +0000 |
4366 | @@ -0,0 +1,14 @@ |
4367 | +[Desktop Entry] |
4368 | +_Name=Terminal |
4369 | +_Comment=Use the command line |
4370 | +TryExec=gnome-terminal |
4371 | +Exec=gnome-terminal |
4372 | +Icon=utilities-terminal |
4373 | +Type=Application |
4374 | +X-GNOME-DocPath=gnome-terminal/index.html |
4375 | +X-GNOME-Bugzilla-Bugzilla=GNOME |
4376 | +X-GNOME-Bugzilla-Product=gnome-terminal |
4377 | +X-GNOME-Bugzilla-Component=BugBuddyBugs |
4378 | +X-GNOME-Bugzilla-Version=@VERSION@ |
4379 | +Categories=GNOME;GTK;Utility;TerminalEmulator; |
4380 | +StartupNotify=true |
4381 | |
4382 | === added directory '.pc/02_add_transparency_properties.patch' |
4383 | === added directory '.pc/02_add_transparency_properties.patch/src' |
4384 | === added file '.pc/02_add_transparency_properties.patch/src/gnome-terminal.schemas.in' |
4385 | --- .pc/02_add_transparency_properties.patch/src/gnome-terminal.schemas.in 1970-01-01 00:00:00 +0000 |
4386 | +++ .pc/02_add_transparency_properties.patch/src/gnome-terminal.schemas.in 2011-05-27 08:11:08 +0000 |
4387 | @@ -0,0 +1,1302 @@ |
4388 | +<gconfschemafile> |
4389 | + <schemalist> |
4390 | + |
4391 | + |
4392 | + |
4393 | + <!-- Global settings --> |
4394 | + |
4395 | + |
4396 | + |
4397 | + <schema> |
4398 | + <key>/schemas/apps/gnome-terminal/global/profile_list</key> |
4399 | + <applyto>/apps/gnome-terminal/global/profile_list</applyto> |
4400 | + <owner>gnome-terminal</owner> |
4401 | + <type>list</type> |
4402 | + <list_type>string</list_type> |
4403 | + <default>[Default]</default> |
4404 | + <locale name="C"> |
4405 | + <short>List of profiles</short> |
4406 | + <long> |
4407 | + List of profiles known to gnome-terminal. The list contains |
4408 | + strings naming subdirectories relative to |
4409 | + /apps/gnome-terminal/profiles. |
4410 | + </long> |
4411 | + </locale> |
4412 | + </schema> |
4413 | + |
4414 | + <schema> |
4415 | + <key>/schemas/apps/gnome-terminal/global/default_profile</key> |
4416 | + <applyto>/apps/gnome-terminal/global/default_profile</applyto> |
4417 | + <owner>gnome-terminal</owner> |
4418 | + <type>string</type> |
4419 | + <default>Default</default> |
4420 | + <locale name="C"> |
4421 | + <short>Profile to use for new terminals</short> |
4422 | + <long> |
4423 | + Profile to be used when opening a new window or tab. |
4424 | + Must be in profile_list. |
4425 | + </long> |
4426 | + </locale> |
4427 | + </schema> |
4428 | + |
4429 | + <schema> |
4430 | + <key>/schemas/apps/gnome-terminal/global/use_mnemonics</key> |
4431 | + <applyto>/apps/gnome-terminal/global/use_mnemonics</applyto> |
4432 | + <owner>gnome-terminal</owner> |
4433 | + <type>bool</type> |
4434 | + <default>true</default> |
4435 | + <locale name="C"> |
4436 | + <short>Whether the menubar has access keys</short> |
4437 | + <long> |
4438 | + Whether to have Alt+letter access keys for the menubar. |
4439 | + They may interfere with some applications run inside the terminal |
4440 | + so it's possible to turn them off. |
4441 | + </long> |
4442 | + </locale> |
4443 | + </schema> |
4444 | + |
4445 | + <schema> |
4446 | + <key>/schemas/apps/gnome-terminal/global/use_menu_accelerators</key> |
4447 | + <applyto>/apps/gnome-terminal/global/use_menu_accelerators</applyto> |
4448 | + <owner>gnome-terminal</owner> |
4449 | + <type>bool</type> |
4450 | + <default>true</default> |
4451 | + <locale name="C"> |
4452 | + <short>Whether the standard GTK shortcut for menubar access is enabled</short> |
4453 | + <long> |
4454 | + Normally you can access the menubar with F10. This can also |
4455 | + be customized via gtkrc (gtk-menu-bar-accel = |
4456 | + "whatever"). This option allows the standard menubar |
4457 | + accelerator to be disabled. |
4458 | + </long> |
4459 | + </locale> |
4460 | + </schema> |
4461 | + |
4462 | + |
4463 | + <schema> |
4464 | + <key>/schemas/apps/gnome-terminal/global/active_encodings</key> |
4465 | + <applyto>/apps/gnome-terminal/global/active_encodings</applyto> |
4466 | + <owner>gnome-terminal</owner> |
4467 | + <type>list</type> |
4468 | + <list_type>string</list_type> |
4469 | + <locale name="C"> |
4470 | + <default><!-- Translators: Please note that this has to be a list of |
4471 | + valid encodings (which are to be taken from the list in src/encoding.c). |
4472 | + It has to include UTF-8 and the word 'current', which is not to be |
4473 | + translated. This is provided for customization of the default encoding |
4474 | + menu; see bug 144810 for an use case. In most cases, this should be |
4475 | + left alone. -->[UTF-8,current]</default> |
4476 | + <short>List of available encodings</short> |
4477 | + <long> |
4478 | + A subset of possible encodings are presented in |
4479 | + the Encoding submenu. This is a list of encodings |
4480 | + to appear there. The special encoding name "current" |
4481 | + means to display the encoding of the current locale. |
4482 | + </long> |
4483 | + </locale> |
4484 | + </schema> |
4485 | + |
4486 | + <schema> |
4487 | + <key>/schemas/apps/gnome-terminal/global/confirm_window_close</key> |
4488 | + <applyto>/apps/gnome-terminal/global/confirm_window_close</applyto> |
4489 | + <owner>gnome-terminal</owner> |
4490 | + <type>bool</type> |
4491 | + <default>true</default> |
4492 | + <locale name="C"> |
4493 | + <short>Whether to ask for confirmation when closing terminal windows</short> |
4494 | + <long> |
4495 | + Whether to ask for confirmation when closing a terminal window which has |
4496 | + more than one open tab. |
4497 | + </long> |
4498 | + </locale> |
4499 | + </schema> |
4500 | + |
4501 | + |
4502 | + |
4503 | + |
4504 | + <!-- Per-profile settings --> |
4505 | + |
4506 | + |
4507 | + |
4508 | + |
4509 | + <schema> |
4510 | + <key>/schemas/apps/gnome-terminal/profiles/Default/visible_name</key> |
4511 | + <applyto>/apps/gnome-terminal/profiles/Default/visible_name</applyto> |
4512 | + <owner>gnome-terminal</owner> |
4513 | + <type>string</type> |
4514 | + <locale name="C"> |
4515 | + <default>Default</default> |
4516 | + <short>Human-readable name of the profile</short> |
4517 | + <long> |
4518 | + Human-readable name of the profile. |
4519 | + </long> |
4520 | + </locale> |
4521 | + </schema> |
4522 | + |
4523 | + <schema> |
4524 | + <key>/schemas/apps/gnome-terminal/profiles/Default/default_show_menubar</key> |
4525 | + <applyto>/apps/gnome-terminal/profiles/Default/default_show_menubar</applyto> |
4526 | + <owner>gnome-terminal</owner> |
4527 | + <type>bool</type> |
4528 | + <default>true</default> |
4529 | + <locale name="C"> |
4530 | + <short>Whether to show menubar in new windows/tabs</short> |
4531 | + <long> |
4532 | + True if the menubar should be shown in new windows, |
4533 | + for windows/tabs with this profile. |
4534 | + </long> |
4535 | + </locale> |
4536 | + </schema> |
4537 | + |
4538 | + <schema> |
4539 | + <key>/schemas/apps/gnome-terminal/profiles/Default/foreground_color</key> |
4540 | + <applyto>/apps/gnome-terminal/profiles/Default/foreground_color</applyto> |
4541 | + <owner>gnome-terminal</owner> |
4542 | + <type>string</type> |
4543 | + <default>#000000</default> |
4544 | + <locale name="C"> |
4545 | + <short>Default color of text in the terminal</short> |
4546 | + <long> |
4547 | + Default color of text in the terminal, as a color |
4548 | + specification (can be HTML-style hex digits, or |
4549 | + a color name such as "red"). |
4550 | + </long> |
4551 | + </locale> |
4552 | + </schema> |
4553 | + |
4554 | + <schema> |
4555 | + <key>/schemas/apps/gnome-terminal/profiles/Default/background_color</key> |
4556 | + <applyto>/apps/gnome-terminal/profiles/Default/background_color</applyto> |
4557 | + <owner>gnome-terminal</owner> |
4558 | + <type>string</type> |
4559 | + <default>#FFFFDD</default> |
4560 | + <locale name="C"> |
4561 | + <short>Default color of terminal background</short> |
4562 | + <long> |
4563 | + Default color of terminal background, as a color |
4564 | + specification (can be HTML-style hex digits, or |
4565 | + a color name such as "red"). |
4566 | + </long> |
4567 | + </locale> |
4568 | + </schema> |
4569 | + |
4570 | + <schema> |
4571 | + <key>/schemas/apps/gnome-terminal/profiles/Default/bold_color</key> |
4572 | + <applyto>/apps/gnome-terminal/profiles/Default/bold_color</applyto> |
4573 | + <owner>gnome-terminal</owner> |
4574 | + <type>string</type> |
4575 | + <default>#000000</default> |
4576 | + <locale name="C"> |
4577 | + <short>Default color of bold text in the terminal</short> |
4578 | + <long> |
4579 | + Default color of bold text in the terminal, as a color |
4580 | + specification (can be HTML-style hex digits, or |
4581 | + a color name such as "red"). |
4582 | + This is ignored if bold_color_same_as_fg is true. |
4583 | + </long> |
4584 | + </locale> |
4585 | + </schema> |
4586 | + |
4587 | + <schema> |
4588 | + <key>/schemas/apps/gnome-terminal/profiles/Default/bold_color_same_as_fg</key> |
4589 | + <applyto>/apps/gnome-terminal/profiles/Default/bold_color_same_as_fg</applyto> |
4590 | + <owner>gnome-terminal</owner> |
4591 | + <type>bool</type> |
4592 | + <default>true</default> |
4593 | + <locale name="C"> |
4594 | + <short>Whether bold text should use the same color as normal text</short> |
4595 | + <long> |
4596 | + If true, boldface text will be rendered using the same color as |
4597 | + normal text. |
4598 | + </long> |
4599 | + </locale> |
4600 | + </schema> |
4601 | + |
4602 | + <schema> |
4603 | + <key>/schemas/apps/gnome-terminal/profiles/Default/title_mode</key> |
4604 | + <applyto>/apps/gnome-terminal/profiles/Default/title_mode</applyto> |
4605 | + <owner>gnome-terminal</owner> |
4606 | + <type>string</type> |
4607 | + <default>replace</default> |
4608 | + <locale name="C"> |
4609 | + <short>What to do with dynamic title</short> |
4610 | + <long> |
4611 | + If the application in the terminal sets the title |
4612 | + (most typically people have their shell set up to |
4613 | + do this), the dynamically-set title can |
4614 | + erase the configured title, go before it, go after it, |
4615 | + or replace it. The possible values are "replace", |
4616 | + "before", "after", and "ignore". |
4617 | + </long> |
4618 | + </locale> |
4619 | + </schema> |
4620 | + |
4621 | + <schema> |
4622 | + <key>/schemas/apps/gnome-terminal/profiles/Default/title</key> |
4623 | + <applyto>/apps/gnome-terminal/profiles/Default/title</applyto> |
4624 | + <owner>gnome-terminal</owner> |
4625 | + <type>string</type> |
4626 | + <locale name="C"> |
4627 | + <default>Terminal</default> |
4628 | + <short>Title for terminal</short> |
4629 | + <long> |
4630 | + Title to display for the terminal window or tab. |
4631 | + This title may be replaced by or combined with |
4632 | + the title set by the application inside the terminal, |
4633 | + depending on the title_mode setting. |
4634 | + </long> |
4635 | + </locale> |
4636 | + </schema> |
4637 | + |
4638 | + <schema> |
4639 | + <key>/schemas/apps/gnome-terminal/profiles/Default/allow_bold</key> |
4640 | + <applyto>/apps/gnome-terminal/profiles/Default/allow_bold</applyto> |
4641 | + <owner>gnome-terminal</owner> |
4642 | + <type>bool</type> |
4643 | + <default>true</default> |
4644 | + <locale name="C"> |
4645 | + <short>Whether to allow bold text</short> |
4646 | + <long> |
4647 | + If true, allow applications in the terminal to make |
4648 | + text boldface. |
4649 | + </long> |
4650 | + </locale> |
4651 | + </schema> |
4652 | + |
4653 | + <schema> |
4654 | + <key>/schemas/apps/gnome-terminal/profiles/Default/silent_bell</key> |
4655 | + <applyto>/apps/gnome-terminal/profiles/Default/silent_bell</applyto> |
4656 | + <owner>gnome-terminal</owner> |
4657 | + <type>bool</type> |
4658 | + <default>false</default> |
4659 | + <locale name="C"> |
4660 | + <short>Whether to silence terminal bell</short> |
4661 | + <long> |
4662 | + If true, don't make a noise when applications send the |
4663 | + escape sequence for the terminal bell. |
4664 | + </long> |
4665 | + </locale> |
4666 | + </schema> |
4667 | + |
4668 | + <schema> |
4669 | + <key>/schemas/apps/gnome-terminal/profiles/Default/word_chars</key> |
4670 | + <applyto>/apps/gnome-terminal/profiles/Default/word_chars</applyto> |
4671 | + <owner>gnome-terminal</owner> |
4672 | + <type>string</type> |
4673 | + <default>-A-Za-z0-9,./?%&#:_=+@~</default> |
4674 | + <locale name="C"> |
4675 | + <short>Characters that are considered "part of a word"</short> |
4676 | + <long> |
4677 | + When selecting text by word, sequences of these characters |
4678 | + are considered single words. Ranges can be given as |
4679 | + "A-Z". Literal hyphen (not expressing a range) should be |
4680 | + the first character given. |
4681 | + </long> |
4682 | + </locale> |
4683 | + </schema> |
4684 | + |
4685 | + <schema> |
4686 | + <key>/schemas/apps/gnome-terminal/profiles/Default/use_custom_default_size</key> |
4687 | + <applyto>/apps/gnome-terminal/profiles/Default/use_custom_default_size</applyto> |
4688 | + <owner>gnome-terminal</owner> |
4689 | + <type>bool</type> |
4690 | + <default>false</default> |
4691 | + <locale name="C"> |
4692 | + <short>Whether to use custom terminal size for new windows</short> |
4693 | + <long> |
4694 | + If true, newly created terminal windows will have custom |
4695 | + size specified by default_size_columns and default_size_rows. |
4696 | + </long> |
4697 | + </locale> |
4698 | + </schema> |
4699 | + <schema> |
4700 | + <key>/schemas/apps/gnome-terminal/profiles/Default/default_size_columns</key> |
4701 | + <applyto>/apps/gnome-terminal/profiles/Default/default_size_columns</applyto> |
4702 | + <owner>gnome-terminal</owner> |
4703 | + <type>int</type> |
4704 | + <default>80</default> |
4705 | + <locale name="C"> |
4706 | + <short>Default number of columns</short> |
4707 | + <long> |
4708 | + Number of columns in newly created terminal windows. |
4709 | + Has no effect if use_custom_default_size is not enabled. |
4710 | + </long> |
4711 | + </locale> |
4712 | + </schema> |
4713 | + |
4714 | + <schema> |
4715 | + <key>/schemas/apps/gnome-terminal/profiles/Default/default_size_rows</key> |
4716 | + <applyto>/apps/gnome-terminal/profiles/Default/default_size_rows</applyto> |
4717 | + <owner>gnome-terminal</owner> |
4718 | + <type>int</type> |
4719 | + <default>24</default> |
4720 | + <locale name="C"> |
4721 | + <short>Default number of rows</short> |
4722 | + <long> |
4723 | + Number of rows in newly created terminal windows. |
4724 | + Has no effect if use_custom_default_size is not enabled. |
4725 | + </long> |
4726 | + </locale> |
4727 | + </schema> |
4728 | + |
4729 | + <schema> |
4730 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scrollbar_position</key> |
4731 | + <applyto>/apps/gnome-terminal/profiles/Default/scrollbar_position</applyto> |
4732 | + <owner>gnome-terminal</owner> |
4733 | + <type>string</type> |
4734 | + <default>right</default> |
4735 | + <locale name="C"> |
4736 | + <short>Position of the scrollbar</short> |
4737 | + <long> |
4738 | + Where to put the terminal scrollbar. Possibilities are |
4739 | + "left", "right", and "hidden". |
4740 | + </long> |
4741 | + </locale> |
4742 | + </schema> |
4743 | + |
4744 | + <schema> |
4745 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scrollback_lines</key> |
4746 | + <applyto>/apps/gnome-terminal/profiles/Default/scrollback_lines</applyto> |
4747 | + <owner>gnome-terminal</owner> |
4748 | + <type>int</type> |
4749 | + <default>512</default> |
4750 | + <locale name="C"> |
4751 | + <short>Number of lines to keep in scrollback</short> |
4752 | + <long> |
4753 | + Number of scrollback lines to keep around. You can |
4754 | + scroll back in the terminal by this number of lines; |
4755 | + lines that don't fit in the scrollback are discarded. |
4756 | + If scrollback_unlimited is true, this value is ignored. |
4757 | + </long> |
4758 | + </locale> |
4759 | + </schema> |
4760 | + |
4761 | + <schema> |
4762 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scrollback_unlimited</key> |
4763 | + <applyto>/apps/gnome-terminal/profiles/Default/scrollback_unlimited</applyto> |
4764 | + <owner>gnome-terminal</owner> |
4765 | + <type>bool</type> |
4766 | + <default>false</default> |
4767 | + <locale name="C"> |
4768 | + <short>Whether an unlimited number of lines should be kept in scrollback</short> |
4769 | + <long> |
4770 | + If true, scrollback lines will never be discarded. The scrollback |
4771 | + history is stored on disk temporarily, so this may cause the system |
4772 | + to run out of disk space if there is a lot of output to the |
4773 | + terminal. |
4774 | + </long> |
4775 | + </locale> |
4776 | + </schema> |
4777 | + |
4778 | + <schema> |
4779 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scroll_on_keystroke</key> |
4780 | + <applyto>/apps/gnome-terminal/profiles/Default/scroll_on_keystroke</applyto> |
4781 | + <owner>gnome-terminal</owner> |
4782 | + <type>bool</type> |
4783 | + <default>true</default> |
4784 | + <locale name="C"> |
4785 | + <short>Whether to scroll to the bottom when a key is pressed</short> |
4786 | + <long> |
4787 | + If true, pressing a key jumps the scrollbar to the bottom. |
4788 | + </long> |
4789 | + </locale> |
4790 | + </schema> |
4791 | + |
4792 | + <schema> |
4793 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scroll_on_output</key> |
4794 | + <applyto>/apps/gnome-terminal/profiles/Default/scroll_on_output</applyto> |
4795 | + <owner>gnome-terminal</owner> |
4796 | + <type>bool</type> |
4797 | + <default>false</default> |
4798 | + <locale name="C"> |
4799 | + <short>Whether to scroll to the bottom when there's new output</short> |
4800 | + <long> |
4801 | + If true, whenever there's new output the terminal will scroll |
4802 | + to the bottom. |
4803 | + </long> |
4804 | + </locale> |
4805 | + </schema> |
4806 | + |
4807 | + <schema> |
4808 | + <key>/schemas/apps/gnome-terminal/profiles/Default/exit_action</key> |
4809 | + <applyto>/apps/gnome-terminal/profiles/Default/exit_action</applyto> |
4810 | + <owner>gnome-terminal</owner> |
4811 | + <type>string</type> |
4812 | + <default>close</default> |
4813 | + <locale name="C"> |
4814 | + <short>What to do with the terminal when the child command exits</short> |
4815 | + <long> |
4816 | + Possible values are "close" to close the terminal, and |
4817 | + "restart" to restart the command. |
4818 | + </long> |
4819 | + </locale> |
4820 | + </schema> |
4821 | + |
4822 | + <schema> |
4823 | + <key>/schemas/apps/gnome-terminal/profiles/Default/login_shell</key> |
4824 | + <applyto>/apps/gnome-terminal/profiles/Default/login_shell</applyto> |
4825 | + <owner>gnome-terminal</owner> |
4826 | + <type>bool</type> |
4827 | + <default>false</default> |
4828 | + <locale name="C"> |
4829 | + <short>Whether to launch the command in the terminal as a login shell</short> |
4830 | + <long> |
4831 | + If true, the command inside the terminal will be launched as |
4832 | + a login shell. (argv[0] will have a hyphen in front of it.) |
4833 | + </long> |
4834 | + </locale> |
4835 | + </schema> |
4836 | + |
4837 | + <schema> |
4838 | + <key>/schemas/apps/gnome-terminal/profiles/Default/update_records</key> |
4839 | + <applyto>/apps/gnome-terminal/profiles/Default/update_records</applyto> |
4840 | + <owner>gnome-terminal</owner> |
4841 | + <type>bool</type> |
4842 | + <default>true</default> |
4843 | + <locale name="C"> |
4844 | + <short>Whether to update login records when launching terminal command</short> |
4845 | + <long> |
4846 | + If true, the system login records utmp and wtmp will be updated when the command inside the terminal |
4847 | + is launched. |
4848 | + </long> |
4849 | + </locale> |
4850 | + </schema> |
4851 | + |
4852 | + <schema> |
4853 | + <key>/schemas/apps/gnome-terminal/profiles/Default/use_custom_command</key> |
4854 | + <applyto>/apps/gnome-terminal/profiles/Default/use_custom_command</applyto> |
4855 | + <owner>gnome-terminal</owner> |
4856 | + <type>bool</type> |
4857 | + <default>false</default> |
4858 | + <locale name="C"> |
4859 | + <short>Whether to run a custom command instead of the shell</short> |
4860 | + <long> |
4861 | + If true, the value of the custom_command setting will |
4862 | + be used in place of running a shell. |
4863 | + </long> |
4864 | + </locale> |
4865 | + </schema> |
4866 | + |
4867 | + <schema> |
4868 | + <key>/schemas/apps/gnome-terminal/profiles/Default/cursor_blink_mode</key> |
4869 | + <applyto>/apps/gnome-terminal/profiles/Default/cursor_blink_mode</applyto> |
4870 | + <owner>gnome-terminal</owner> |
4871 | + <type>string</type> |
4872 | + <default>system</default> |
4873 | + <locale name="C"> |
4874 | + <short>Whether to blink the cursor</short> |
4875 | + <long> |
4876 | + The possible values are "system" to use the global cursor blinking |
4877 | + settings, or "on" or "off" to set the mode explicitly. |
4878 | + </long> |
4879 | + </locale> |
4880 | + </schema> |
4881 | + |
4882 | + <schema> |
4883 | + <key>/schemas/apps/gnome-terminal/profiles/Default/cursor_shape</key> |
4884 | + <applyto>/apps/gnome-terminal/profiles/Default/cursor_shape</applyto> |
4885 | + <owner>gnome-terminal</owner> |
4886 | + <type>string</type> |
4887 | + <default>block</default> |
4888 | + <locale name="C"> |
4889 | + <short>The cursor appearance</short> |
4890 | + <long> |
4891 | + The possible values are "block" to use a block cursor, "ibeam" to |
4892 | + use a vertical line cursor, or "underline" to use an underline cursor. |
4893 | + </long> |
4894 | + </locale> |
4895 | + </schema> |
4896 | + |
4897 | + <schema> |
4898 | + <key>/schemas/apps/gnome-terminal/profiles/Default/custom_command</key> |
4899 | + <applyto>/apps/gnome-terminal/profiles/Default/custom_command</applyto> |
4900 | + <owner>gnome-terminal</owner> |
4901 | + <type>string</type> |
4902 | + <default></default> |
4903 | + <locale name="C"> |
4904 | + <short>Custom command to use instead of the shell</short> |
4905 | + <long> |
4906 | + Run this command in place of the shell, if |
4907 | + use_custom_command is true. |
4908 | + </long> |
4909 | + </locale> |
4910 | + </schema> |
4911 | + |
4912 | + <schema> |
4913 | + <key>/schemas/apps/gnome-terminal/profiles/Default/icon</key> |
4914 | + <applyto>/apps/gnome-terminal/profiles/Default/icon</applyto> |
4915 | + <owner>gnome-terminal</owner> |
4916 | + <type>string</type> |
4917 | + <default></default> |
4918 | + <locale name="C"> |
4919 | + <short>Icon for terminal window</short> |
4920 | + <long> |
4921 | + Icon to use for tabs/windows containing this profile. |
4922 | + </long> |
4923 | + </locale> |
4924 | + </schema> |
4925 | + |
4926 | + <schema> |
4927 | + <key>/schemas/apps/gnome-terminal/profiles/Default/palette</key> |
4928 | + <applyto>/apps/gnome-terminal/profiles/Default/palette</applyto> |
4929 | + <owner>gnome-terminal</owner> |
4930 | + <type>string</type> |
4931 | + <default>#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC</default> |
4932 | + <locale name="C"> |
4933 | + <short>Palette for terminal applications</short> |
4934 | + <long> |
4935 | + Terminals have a 16-color palette that applications inside |
4936 | + the terminal can use. This is that palette, in the form |
4937 | + of a colon-separated list of color names. Color names |
4938 | + should be in hex format e.g. "#FF00FF" |
4939 | + </long> |
4940 | + </locale> |
4941 | + </schema> |
4942 | + |
4943 | + <schema> |
4944 | + <key>/schemas/apps/gnome-terminal/profiles/Default/font</key> |
4945 | + <applyto>/apps/gnome-terminal/profiles/Default/font</applyto> |
4946 | + <owner>gnome-terminal</owner> |
4947 | + <type>string</type> |
4948 | + <default>Monospace 12</default> |
4949 | + <locale name="C"> |
4950 | + <short>Font</short> |
4951 | + <long> |
4952 | + An Pango font name. Examples are "Sans 12" or "Monospace Bold 14". |
4953 | + </long> |
4954 | + </locale> |
4955 | + </schema> |
4956 | + |
4957 | + <schema> |
4958 | + <key>/schemas/apps/gnome-terminal/profiles/Default/background_type</key> |
4959 | + <applyto>/apps/gnome-terminal/profiles/Default/background_type</applyto> |
4960 | + <owner>gnome-terminal</owner> |
4961 | + <type>string</type> |
4962 | + <default>solid</default> |
4963 | + <locale name="C"> |
4964 | + <short>Background type</short> |
4965 | + <long> |
4966 | + Type of terminal background. May be "solid" for a solid color, |
4967 | + "image" for an image, or "transparent" for either real transparency if |
4968 | + a compositing window manager is running, or pseudo-transparency |
4969 | + otherwise. |
4970 | + </long> |
4971 | + </locale> |
4972 | + </schema> |
4973 | + |
4974 | + <schema> |
4975 | + <key>/schemas/apps/gnome-terminal/profiles/Default/background_image</key> |
4976 | + <applyto>/apps/gnome-terminal/profiles/Default/background_image</applyto> |
4977 | + <owner>gnome-terminal</owner> |
4978 | + <type>string</type> |
4979 | + <default></default> |
4980 | + <locale name="C"> |
4981 | + <short>Background image</short> |
4982 | + <long> |
4983 | + Filename of a background image. |
4984 | + </long> |
4985 | + </locale> |
4986 | + </schema> |
4987 | + |
4988 | + <schema> |
4989 | + <key>/schemas/apps/gnome-terminal/profiles/Default/scroll_background</key> |
4990 | + <applyto>/apps/gnome-terminal/profiles/Default/scroll_background</applyto> |
4991 | + <owner>gnome-terminal</owner> |
4992 | + <type>bool</type> |
4993 | + <default>true</default> |
4994 | + <locale name="C"> |
4995 | + <short>Whether to scroll background image</short> |
4996 | + <long> |
4997 | + If true, scroll the background image with the foreground |
4998 | + text; if false, keep the image in a fixed position and |
4999 | + scroll the text above it. |
5000 | + </long> |