Compare commits
No commits in common. "85424d6b5dff6d5fb2fbdd3005276c507394c597" and "ab56ecda0fc40c3889094d969f0ef86777d1b76e" have entirely different histories.
85424d6b5d
...
ab56ecda0f
|
@ -0,0 +1,19 @@
|
||||||
|
#### Expected behaviour
|
||||||
|
|
||||||
|
|
||||||
|
#### Actual behaviour
|
||||||
|
|
||||||
|
|
||||||
|
#### Steps to reproduce the behaviour
|
||||||
|
|
||||||
|
|
||||||
|
#### MATE general version
|
||||||
|
|
||||||
|
|
||||||
|
#### Package version
|
||||||
|
|
||||||
|
|
||||||
|
#### Linux Distribution
|
||||||
|
|
||||||
|
|
||||||
|
#### Link to downstream report of your Distribution
|
|
@ -0,0 +1,116 @@
|
||||||
|
# vim: set ts=2 sts=2 sw=2 expandtab :
|
||||||
|
dist: xenial
|
||||||
|
sudo: required
|
||||||
|
language: bash
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build
|
||||||
|
- chmod +x docker-build
|
||||||
|
|
||||||
|
install:
|
||||||
|
- sudo apt-get install -y python3-pip python3-setuptools
|
||||||
|
- sudo pip3 install --upgrade pip
|
||||||
|
- sudo pip install PyGithub
|
||||||
|
- ./docker-build --name ${DISTRO} --config .travis.yml --install
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./docker-build --name ${DISTRO} --verbose --config .travis.yml --build autotools
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
- provider: script
|
||||||
|
script: ./docker-build --verbose --config .travis.yml --release github
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
condition: "${TRAVIS_TAG} =~ ^v.*$ && ${DISTRO} =~ ^fedora.*$"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- DISTRO="archlinux/base"
|
||||||
|
- DISTRO="debian:sid"
|
||||||
|
- DISTRO="fedora:29"
|
||||||
|
- DISTRO="ubuntu:18.10"
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
# THE FOLLOWING LINES IS USED BY docker-build
|
||||||
|
##########################################################
|
||||||
|
requires:
|
||||||
|
archlinux:
|
||||||
|
# Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-terminal
|
||||||
|
- gcc
|
||||||
|
- git
|
||||||
|
- intltool
|
||||||
|
- libsm
|
||||||
|
- make
|
||||||
|
- mate-common
|
||||||
|
- mate-desktop
|
||||||
|
- vte3
|
||||||
|
- which
|
||||||
|
- yelp-tools
|
||||||
|
|
||||||
|
debian:
|
||||||
|
# Useful URL: https://github.com/mate-desktop/debian-packages
|
||||||
|
# Useful URL: https://salsa.debian.org/debian-mate-team/mate-terminal
|
||||||
|
- git
|
||||||
|
- intltool
|
||||||
|
- intltool
|
||||||
|
- libdconf-dev
|
||||||
|
- libglib2.0-dev
|
||||||
|
- libgtk-3-dev
|
||||||
|
- libsm-dev
|
||||||
|
- libvte-2.91-dev
|
||||||
|
- libx11-dev
|
||||||
|
- make
|
||||||
|
- mate-common
|
||||||
|
- yelp-tools
|
||||||
|
|
||||||
|
fedora:
|
||||||
|
# Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-terminal.git
|
||||||
|
- gcc
|
||||||
|
- dconf-devel
|
||||||
|
- desktop-file-utils
|
||||||
|
- git
|
||||||
|
- gtk3-devel
|
||||||
|
- libSM-devel
|
||||||
|
- make
|
||||||
|
- mate-common
|
||||||
|
- redhat-rpm-config
|
||||||
|
- vte291-devel
|
||||||
|
|
||||||
|
ubuntu:
|
||||||
|
- git
|
||||||
|
- intltool
|
||||||
|
- intltool
|
||||||
|
- libdconf-dev
|
||||||
|
- libglib2.0-dev
|
||||||
|
- libgtk-3-dev
|
||||||
|
- libsm-dev
|
||||||
|
- libvte-2.91-dev
|
||||||
|
- libx11-dev
|
||||||
|
- make
|
||||||
|
- mate-common
|
||||||
|
- yelp-tools
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- CFLAGS="-Wall -Werror=format-security"
|
||||||
|
|
||||||
|
before_scripts:
|
||||||
|
- if [ ${DISTRO_NAME} == "debian" ];then
|
||||||
|
- curl -Ls -o debian.sh https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/debian.sh
|
||||||
|
- bash ./debian.sh
|
||||||
|
- fi
|
||||||
|
|
||||||
|
after_scripts:
|
||||||
|
- make distcheck
|
||||||
|
|
||||||
|
releases:
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
checksum: true
|
||||||
|
file_glob: true
|
||||||
|
files: mate-terminal-*.tar.xz
|
||||||
|
github_release:
|
||||||
|
tags: true
|
||||||
|
overwrite: true
|
||||||
|
base_version: 1.20.0
|
18
Makefile.am
18
Makefile.am
|
@ -1,4 +1,4 @@
|
||||||
SUBDIRS = src po
|
SUBDIRS = src po help
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||||
|
|
||||||
|
@ -11,31 +11,29 @@ DISTCHECK_CONFIGURE_FLAGS = \
|
||||||
|
|
||||||
@INTLTOOL_XML_RULE@
|
@INTLTOOL_XML_RULE@
|
||||||
appdatadir = $(datadir)/metainfo
|
appdatadir = $(datadir)/metainfo
|
||||||
appdata_in_files = gatuno-terminal.appdata.xml.in
|
appdata_in_files = mate-terminal.appdata.xml.in
|
||||||
appdata_DATA = $(appdata_in_files:.xml.in=.xml)
|
appdata_DATA = $(appdata_in_files:.xml.in=.xml)
|
||||||
|
|
||||||
desktopdir = $(datadir)/applications
|
desktopdir = $(datadir)/applications
|
||||||
desktop_in_files = @PACKAGE@.desktop.in.in
|
desktop_in_files = @PACKAGE@.desktop.in.in
|
||||||
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
|
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
|
||||||
|
|
||||||
@INTLTOOL_DESKTOP_RULE@
|
@INTLTOOL_DESKTOP_RULE@
|
||||||
|
|
||||||
man_MANS = gatuno-terminal.1
|
man_MANS = mate-terminal.1
|
||||||
|
|
||||||
bin_SCRIPTS = gatuno-terminal.wrapper
|
bin_SCRIPTS = mate-terminal.wrapper
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
config.rpath \
|
autogen.sh \
|
||||||
xmldocs.make \
|
xmldocs.make \
|
||||||
omf.make \
|
omf.make \
|
||||||
gatuno-terminal.wrapper \
|
mate-terminal.wrapper \
|
||||||
$(appdata_in_files) \
|
$(appdata_in_files) \
|
||||||
$(man_MANS) \
|
$(man_MANS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
# autogen.sh
|
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
gatuno-terminal.appdata.xml \
|
mate-terminal.appdata.xml \
|
||||||
$(desktop_DATA) \
|
$(desktop_DATA) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
3
README
3
README
|
@ -1,10 +1,9 @@
|
||||||
|
|
||||||
This is the Gatuno terminal emulator application. gatuno-terminal is
|
This is the MATE terminal emulator application. mate-terminal is
|
||||||
only the shell (menubar, prefs dialog); the terminal emulation ("stuff
|
only the shell (menubar, prefs dialog); the terminal emulation ("stuff
|
||||||
in the middle") comes from the VTE widget. Remember this when you
|
in the middle") comes from the VTE widget. Remember this when you
|
||||||
report a bug. ;-)
|
report a bug. ;-)
|
||||||
|
|
||||||
Gatuno Terminal is a fork of Mate terminal.
|
|
||||||
MATE terminal is a fork of GNOME terminal.
|
MATE terminal is a fork of GNOME terminal.
|
||||||
|
|
||||||
How it works
|
How it works
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Run this to generate all the initial makefiles, etc.
|
||||||
|
|
||||||
|
srcdir=`dirname $0`
|
||||||
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
|
PKG_NAME="mate-terminal"
|
||||||
|
|
||||||
|
(test -f $srcdir/configure.ac) || {
|
||||||
|
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||||
|
echo " top-level $PKG_NAME directory"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
which mate-autogen || {
|
||||||
|
echo "You need to install mate-common"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
which yelp-build || {
|
||||||
|
echo "You need to install yelp-tools"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
REQUIRED_AUTOMAKE_VERSION=1.9
|
||||||
|
MATE_DATADIR="$mate_datadir"
|
||||||
|
USE_COMMON_DOC_BUILD=yes
|
||||||
|
|
||||||
|
. mate-autogen
|
||||||
|
|
36
configure.ac
36
configure.ac
|
@ -6,7 +6,7 @@ m4_define([gt_version],[gt_version_major().gt_version_minor().gt_version_micro()
|
||||||
|
|
||||||
m4_define([gt_api_version],[0])
|
m4_define([gt_api_version],[0])
|
||||||
|
|
||||||
AC_INIT([Gatuno Terminal],[gt_version],[http://git.gatuno.mx/gatuno/gatuno-terminal],[gatuno-terminal])
|
AC_INIT([MATE Terminal],[gt_version],[http://www.mate-desktop.org],[mate-terminal])
|
||||||
AC_CONFIG_SRCDIR([src/terminal.c])
|
AC_CONFIG_SRCDIR([src/terminal.c])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
@ -14,7 +14,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||||
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz check-news])
|
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz check-news])
|
||||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
GETTEXT_PACKAGE=gatuno-terminal
|
GETTEXT_PACKAGE=mate-terminal
|
||||||
AC_SUBST([GETTEXT_PACKAGE])
|
AC_SUBST([GETTEXT_PACKAGE])
|
||||||
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
|
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
|
||||||
|
|
||||||
|
@ -31,12 +31,18 @@ AC_HEADER_STDC
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
IT_PROG_INTLTOOL([0.50.1])
|
IT_PROG_INTLTOOL([0.50.1])
|
||||||
|
|
||||||
|
MATE_COMMON_INIT
|
||||||
|
MATE_DEBUG_CHECK
|
||||||
|
MATE_COMPILE_WARNINGS([maximum])
|
||||||
|
#MATE_MAINTAINER_MODE_DEFINES
|
||||||
|
|
||||||
AM_GLIB_GNU_GETTEXT
|
AM_GLIB_GNU_GETTEXT
|
||||||
|
|
||||||
GLIB_REQUIRED=2.50.0
|
GLIB_REQUIRED=2.50.0
|
||||||
GIO_REQUIRED=2.50.0
|
GIO_REQUIRED=2.50.0
|
||||||
GTK_REQUIRED=3.22.0
|
GTK_REQUIRED=3.22.0
|
||||||
VTE_REQUIRED=0.48
|
VTE_REQUIRED=0.48
|
||||||
|
DCONF_REQUIRED=0.13.4
|
||||||
|
|
||||||
PKG_CHECK_MODULES([TERM],
|
PKG_CHECK_MODULES([TERM],
|
||||||
[vte-2.91 >= $VTE_REQUIRED
|
[vte-2.91 >= $VTE_REQUIRED
|
||||||
|
@ -44,8 +50,22 @@ PKG_CHECK_MODULES([TERM],
|
||||||
gthread-2.0
|
gthread-2.0
|
||||||
gio-2.0 >= $GIO_REQUIRED
|
gio-2.0 >= $GIO_REQUIRED
|
||||||
gtk+-3.0 >= $GTK_REQUIRED
|
gtk+-3.0 >= $GTK_REQUIRED
|
||||||
|
dconf >= $DCONF_REQUIRED
|
||||||
x11])
|
x11])
|
||||||
|
|
||||||
|
# ********
|
||||||
|
# smclient
|
||||||
|
# ********
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(SMCLIENT, sm >= 1.0.0)
|
||||||
|
AC_SUBST([SMCLIENT_CFLAGS])
|
||||||
|
AC_SUBST([SMCLIENT_LIBS])
|
||||||
|
|
||||||
|
# *****
|
||||||
|
# GSettings
|
||||||
|
# *****
|
||||||
|
|
||||||
|
GLIB_GSETTINGS
|
||||||
|
|
||||||
GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
|
GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
|
||||||
AC_SUBST([GLIB_GENMARSHAL])
|
AC_SUBST([GLIB_GENMARSHAL])
|
||||||
|
@ -86,6 +106,12 @@ fi
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_SKEY],[test "$enable_skey" = "yes"])
|
AM_CONDITIONAL([ENABLE_SKEY],[test "$enable_skey" = "yes"])
|
||||||
|
|
||||||
|
# *************
|
||||||
|
# Documentation
|
||||||
|
# *************
|
||||||
|
|
||||||
|
YELP_HELP_INIT
|
||||||
|
|
||||||
# ****************************
|
# ****************************
|
||||||
|
|
||||||
AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major])
|
AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major])
|
||||||
|
@ -97,10 +123,12 @@ AC_SUBST([TERMINAL_API_VERSION],[gt_api_version])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
gatuno-terminal.desktop.in
|
mate-terminal.desktop.in
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
src/org.mate.terminal.gschema.xml
|
||||||
src/terminal-version.h
|
src/terminal-version.h
|
||||||
src/skey/Makefile
|
src/skey/Makefile
|
||||||
|
help/Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@ -108,7 +136,7 @@ AC_OUTPUT
|
||||||
# ****************************
|
# ****************************
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
gatuno-terminal-$VERSION:
|
mate-terminal-$VERSION:
|
||||||
|
|
||||||
prefix: ${prefix}
|
prefix: ${prefix}
|
||||||
source code location: ${srcdir}
|
source code location: ${srcdir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
_Name=Gatuno Terminal
|
|
||||||
_GenericName=Terminal
|
|
||||||
_Comment=Use the command line
|
|
||||||
TryExec=gatuno-terminal
|
|
||||||
Exec=gatuno-terminal
|
|
||||||
Icon=utilities-terminal
|
|
||||||
Type=Application
|
|
||||||
Categories=System;GTK;Utility;TerminalEmulator;
|
|
||||||
StartupNotify=true
|
|
||||||
|
|
2
makepot
2
makepot
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
PACKAGE=gatuno-terminal;
|
PACKAGE=mate-terminal;
|
||||||
|
|
||||||
# normal translations for the package
|
# normal translations for the package
|
||||||
make -C po $PACKAGE.pot && mv po/$PACKAGE.pot .
|
make -C po $PACKAGE.pot && mv po/$PACKAGE.pot .
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Copyright 2014 MATE team <mate-dev@ml.mate-desktop.org> -->
|
<!-- Copyright 2014 MATE team <mate-dev@ml.mate-desktop.org> -->
|
||||||
<component type="desktop">
|
<component type="desktop">
|
||||||
<id>gatuno-terminal.desktop</id>
|
<id>mate-terminal.desktop</id>
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
<project_license>GPL-3.0+</project_license>
|
<project_license>GPL-3.0+</project_license>
|
||||||
<name>Gatuno Terminal</name>
|
<name>MATE Terminal</name>
|
||||||
<_summary>A terminal emulator for you</_summary>
|
<_summary>A terminal emulator for the MATE desktop environment</_summary>
|
||||||
<_description>
|
<_description>
|
||||||
<p>
|
<p>
|
||||||
Gatuno Terminal is a terminal emulation application that you can use
|
MATE Terminal is a terminal emulation application that you can use
|
||||||
to access a UNIX shell in the destop environment. Gatuno Terminal emulates
|
to access a UNIX shell in the MATE environment. MATE Terminal emulates
|
||||||
the xterm program developed by the X Consortium. It supports translucent
|
the xterm program developed by the X Consortium. It supports translucent
|
||||||
backgrounds, opening multiple terminals in a single window (tabs) and
|
backgrounds, opening multiple terminals in a single window (tabs) and
|
||||||
clickable URLs.
|
clickable URLs.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Gatuno Terminal is a fork of Mate Terminal, which in turn is a fork
|
MATE Terminal is a fork of GNOME Terminal and part of the MATE Desktop Environment.
|
||||||
of GNOME Terminal and part of the MATE Desktop Environment.
|
If you would like to know more about MATE and MATE Terminal, please visit the
|
||||||
If you would like to know more about Gatuno Terminal, please visit the
|
|
||||||
project's home page.
|
project's home page.
|
||||||
</p>
|
</p>
|
||||||
</_description>
|
</_description>
|
||||||
|
@ -40,4 +39,5 @@
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<url type="homepage">http://www.mate-desktop.org</url>
|
<url type="homepage">http://www.mate-desktop.org</url>
|
||||||
<updatecontact>mate-dev@ml.mate-desktop.org</updatecontact>
|
<updatecontact>mate-dev@ml.mate-desktop.org</updatecontact>
|
||||||
|
<project_group>MATE</project_group>
|
||||||
</component>
|
</component>
|
|
@ -0,0 +1,16 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
_Name=MATE Terminal
|
||||||
|
_GenericName=Terminal
|
||||||
|
_Comment=Use the command line
|
||||||
|
TryExec=mate-terminal
|
||||||
|
Exec=mate-terminal
|
||||||
|
Icon=utilities-terminal
|
||||||
|
Type=Application
|
||||||
|
X-MATE-DocPath=mate-terminal/index.html
|
||||||
|
X-MATE-Bugzilla-Bugzilla=MATE
|
||||||
|
X-MATE-Bugzilla-Product=mate-terminal
|
||||||
|
X-MATE-Bugzilla-Component=BugBuddyBugs
|
||||||
|
X-MATE-Bugzilla-Version=@VERSION@
|
||||||
|
Categories=System;GTK;Utility;TerminalEmulator;
|
||||||
|
StartupNotify=true
|
||||||
|
|
|
@ -78,4 +78,4 @@ if ($login == 1)
|
||||||
{
|
{
|
||||||
@args = ('--login', @args);
|
@args = ('--login', @args);
|
||||||
}
|
}
|
||||||
exec('gatuno-terminal',@args);
|
exec('mate-terminal',@args);
|
|
@ -1,269 +0,0 @@
|
||||||
# INTLTOOL_MAKEFILE
|
|
||||||
# Makefile for program source directory in GNU NLS utilities package.
|
|
||||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
|
||||||
#
|
|
||||||
# This file file be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU Public License
|
|
||||||
# but which still want to provide support for the GNU gettext functionality.
|
|
||||||
# Please note that the actual code is *not* freely available.
|
|
||||||
#
|
|
||||||
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
|
|
||||||
# instead of PACKAGE and to look for po2tbl in ./ not in intl/
|
|
||||||
#
|
|
||||||
# - Modified by jacob berkman <jacob@ximian.com> to install
|
|
||||||
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
|
|
||||||
|
|
||||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
VERSION = @VERSION@
|
|
||||||
|
|
||||||
SHELL = @SHELL@
|
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
|
|
||||||
prefix = @prefix@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
datarootdir = @datarootdir@
|
|
||||||
datadir = @datadir@
|
|
||||||
libdir = @libdir@
|
|
||||||
localedir = $(libdir)/locale
|
|
||||||
gnulocaledir = $(datadir)/locale
|
|
||||||
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
|
|
||||||
subdir = po
|
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
MKINSTALLDIRS = mkdir -p
|
|
||||||
|
|
||||||
CC = @CC@
|
|
||||||
GENCAT = @GENCAT@
|
|
||||||
GMSGFMT = @GMSGFMT@
|
|
||||||
MSGFMT = @MSGFMT@
|
|
||||||
MSGFMT_OPTS = @MSGFMT_OPTS@
|
|
||||||
XGETTEXT = @XGETTEXT@
|
|
||||||
MSGMERGE = msgmerge
|
|
||||||
|
|
||||||
DEFS = @DEFS@
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
CPPFLAGS = @CPPFLAGS@
|
|
||||||
|
|
||||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
|
||||||
|
|
||||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
|
||||||
|
|
||||||
SOURCES =
|
|
||||||
POFILES = @POFILES@
|
|
||||||
GMOFILES = @GMOFILES@
|
|
||||||
DISTFILES = LINGUAS ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
|
|
||||||
$(POFILES) $(GMOFILES) $(SOURCES)
|
|
||||||
|
|
||||||
POTFILES = \
|
|
||||||
|
|
||||||
CATALOGS = @CATALOGS@
|
|
||||||
CATOBJEXT = @CATOBJEXT@
|
|
||||||
INSTOBJEXT = @INSTOBJEXT@
|
|
||||||
|
|
||||||
.SUFFIXES:
|
|
||||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(COMPILE) $<
|
|
||||||
|
|
||||||
.po.pox:
|
|
||||||
$(MAKE) $(GETTEXT_PACKAGE).pot
|
|
||||||
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
|
|
||||||
|
|
||||||
.po.mo:
|
|
||||||
$(MSGFMT) -o $@ $<
|
|
||||||
|
|
||||||
.po.gmo:
|
|
||||||
$(AM_V_GEN) file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
|
||||||
&& rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $<
|
|
||||||
|
|
||||||
.po.cat:
|
|
||||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
|
||||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
|
||||||
|
|
||||||
|
|
||||||
all: all-@USE_NLS@
|
|
||||||
|
|
||||||
all-yes: $(CATALOGS)
|
|
||||||
all-no:
|
|
||||||
|
|
||||||
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
|
|
||||||
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --from-code=UTF-8 \
|
|
||||||
--msgid-bugs-address='http://bugzilla.gnome.org/enter_bug.cgi?product=glib&keywords=I18N+L10N&component=general' \
|
|
||||||
--add-comments --keyword=_ --keyword=N_ \
|
|
||||||
--keyword=C_:1c,2 \
|
|
||||||
--keyword=NC_:1c,2 \
|
|
||||||
--keyword=g_dcgettext:2 \
|
|
||||||
--keyword=g_dngettext:2,3 \
|
|
||||||
--keyword=g_dpgettext2:2c,3 \
|
|
||||||
--flag=N_:1:pass-c-format \
|
|
||||||
--flag=C_:2:pass-c-format \
|
|
||||||
--flag=NC_:2:pass-c-format \
|
|
||||||
--flag=g_dngettext:2:pass-c-format \
|
|
||||||
--flag=g_strdup_printf:1:c-format \
|
|
||||||
--flag=g_string_printf:2:c-format \
|
|
||||||
--flag=g_string_append_printf:2:c-format \
|
|
||||||
--flag=g_error_new:3:c-format \
|
|
||||||
--flag=g_set_error:4:c-format \
|
|
||||||
--flag=g_markup_printf_escaped:1:c-format \
|
|
||||||
--flag=g_log:3:c-format \
|
|
||||||
--flag=g_print:1:c-format \
|
|
||||||
--flag=g_printerr:1:c-format \
|
|
||||||
--flag=g_printf:1:c-format \
|
|
||||||
--flag=g_fprintf:2:c-format \
|
|
||||||
--flag=g_sprintf:2:c-format \
|
|
||||||
--flag=g_snprintf:3:c-format \
|
|
||||||
--flag=g_scanner_error:2:c-format \
|
|
||||||
--flag=g_scanner_warn:2:c-format \
|
|
||||||
$(POTFILES) \
|
|
||||||
&& test ! -f $(GETTEXT_PACKAGE).po \
|
|
||||||
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
|
|
||||||
&& mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
|
|
||||||
|
|
||||||
install: install-exec install-data
|
|
||||||
install-exec:
|
|
||||||
install-data: install-data-@USE_NLS@
|
|
||||||
install-data-no: all
|
|
||||||
install-data-yes: all
|
|
||||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
|
|
||||||
catalogs='$(CATALOGS)'; \
|
|
||||||
for cat in $$catalogs; do \
|
|
||||||
cat=`basename $$cat`; \
|
|
||||||
case "$$cat" in \
|
|
||||||
*.gmo) destdir=$(gnulocaledir);; \
|
|
||||||
*) destdir=$(localedir);; \
|
|
||||||
esac; \
|
|
||||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
|
||||||
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
|
|
||||||
$(MKINSTALLDIRS) $$dir; \
|
|
||||||
if test -r $$cat; then \
|
|
||||||
$(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
|
|
||||||
echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
|
|
||||||
else \
|
|
||||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
|
|
||||||
echo "installing $(srcdir)/$$cat as" \
|
|
||||||
"$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
|
|
||||||
fi; \
|
|
||||||
if test -r $$cat.m; then \
|
|
||||||
$(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
|
|
||||||
echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
|
|
||||||
else \
|
|
||||||
if test -r $(srcdir)/$$cat.m ; then \
|
|
||||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
|
||||||
$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
|
|
||||||
echo "installing $(srcdir)/$$cat as" \
|
|
||||||
"$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
|
|
||||||
else \
|
|
||||||
true; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
if test "$(PACKAGE)" = "glib"; then \
|
|
||||||
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
|
|
||||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
|
||||||
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
|
||||||
else \
|
|
||||||
: ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Define this as empty until I found a useful application.
|
|
||||||
installcheck:
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
catalogs='$(CATALOGS)'; \
|
|
||||||
for cat in $$catalogs; do \
|
|
||||||
cat=`basename $$cat`; \
|
|
||||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
|
||||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
|
|
||||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
|
|
||||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
|
|
||||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
|
|
||||||
done
|
|
||||||
if test "$(PACKAGE)" = "glib"; then \
|
|
||||||
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
check: all
|
|
||||||
|
|
||||||
dvi info tags TAGS ID:
|
|
||||||
|
|
||||||
mostlyclean:
|
|
||||||
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
|
|
||||||
rm -fr *.o
|
|
||||||
|
|
||||||
clean: mostlyclean
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
@echo "This command is intended for maintainers to use;"
|
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
|
||||||
rm -f $(GMOFILES)
|
|
||||||
|
|
||||||
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
|
|
||||||
dist distdir: $(DISTFILES)
|
|
||||||
dists="$(DISTFILES)"; \
|
|
||||||
for file in $$dists; do \
|
|
||||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
|
||||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
|
||||||
done
|
|
||||||
|
|
||||||
update-po: Makefile
|
|
||||||
$(MAKE) $(GETTEXT_PACKAGE).pot
|
|
||||||
tmpdir=`pwd`; \
|
|
||||||
cd $(srcdir); \
|
|
||||||
catalogs='$(CATALOGS)'; \
|
|
||||||
for cat in $$catalogs; do \
|
|
||||||
cat=`basename $$cat`; \
|
|
||||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
|
||||||
echo "$$lang:"; \
|
|
||||||
if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
|
|
||||||
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
|
|
||||||
rm -f $$tmpdir/$$lang.new.po; \
|
|
||||||
else \
|
|
||||||
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
|
|
||||||
:; \
|
|
||||||
else \
|
|
||||||
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
|
|
||||||
rm -f $$tmpdir/$$lang.new.po; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
else \
|
|
||||||
echo "msgmerge for $$cat failed!"; \
|
|
||||||
rm -f $$tmpdir/$$lang.new.po; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# POTFILES is created from POTFILES.in by stripping comments, empty lines
|
|
||||||
# and Intltool tags (enclosed in square brackets), and appending a full
|
|
||||||
# relative path to them
|
|
||||||
POTFILES: POTFILES.in
|
|
||||||
( if test 'x$(srcdir)' != 'x.'; then \
|
|
||||||
posrcprefix='$(top_srcdir)/'; \
|
|
||||||
else \
|
|
||||||
posrcprefix="../"; \
|
|
||||||
fi; \
|
|
||||||
rm -f $@-t $@ \
|
|
||||||
&& (sed -e '/^#/d' \
|
|
||||||
-e "s/^\[.*\] +//" \
|
|
||||||
-e '/^[ ]*$$/d' \
|
|
||||||
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
|
|
||||||
| sed -e '$$s/\\$$//') > $@-t \
|
|
||||||
&& chmod a-w $@-t \
|
|
||||||
&& mv $@-t $@ )
|
|
||||||
|
|
||||||
Makefile: Makefile.in.in ../config.status POTFILES
|
|
||||||
cd .. \
|
|
||||||
&& $(SHELL) ./config.status $(subdir)/$@.in
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
||||||
.NOEXPORT:
|
|
|
@ -1,15 +1,18 @@
|
||||||
|
[encoding: UTF-8]
|
||||||
# List of source files containing translatable strings.
|
# List of source files containing translatable strings.
|
||||||
# Please keep this file sorted alphabetically.
|
# Please keep this file sorted alphabetically.
|
||||||
gatuno-terminal.appdata.xml.in
|
mate-terminal.appdata.xml.in
|
||||||
gatuno-terminal.desktop.in.in
|
mate-terminal.desktop.in.in
|
||||||
|
src/eggsmclient.c
|
||||||
|
[type: gettext/gsettings]src/org.mate.terminal.gschema.xml.in
|
||||||
src/profile-editor.c
|
src/profile-editor.c
|
||||||
src/encodings-dialog.ui
|
[type: gettext/glade]src/encodings-dialog.ui
|
||||||
src/find-dialog.ui
|
[type: gettext/glade]src/find-dialog.ui
|
||||||
src/keybinding-editor.ui
|
[type: gettext/glade]src/keybinding-editor.ui
|
||||||
src/profile-manager.ui
|
[type: gettext/glade]src/profile-manager.ui
|
||||||
src/profile-new-dialog.ui
|
[type: gettext/glade]src/profile-new-dialog.ui
|
||||||
src/profile-preferences.ui
|
[type: gettext/glade]src/profile-preferences.ui
|
||||||
src/skey-challenge.ui
|
[type: gettext/glade]src/skey-challenge.ui
|
||||||
src/skey-popup.c
|
src/skey-popup.c
|
||||||
src/terminal-accels.c
|
src/terminal-accels.c
|
||||||
src/terminal-app.c
|
src/terminal-app.c
|
||||||
|
|
|
@ -4,7 +4,7 @@ if ENABLE_SKEY
|
||||||
SUBDIRS = skey
|
SUBDIRS = skey
|
||||||
endif
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS = gatuno-terminal
|
bin_PROGRAMS = mate-terminal
|
||||||
|
|
||||||
BUILT_SOURCES = \
|
BUILT_SOURCES = \
|
||||||
terminal-marshal.c \
|
terminal-marshal.c \
|
||||||
|
@ -15,7 +15,7 @@ BUILT_SOURCES = \
|
||||||
terminal-type-builtins.h \
|
terminal-type-builtins.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
gatuno_terminal_SOURCES= \
|
mate_terminal_SOURCES= \
|
||||||
eggshell.c \
|
eggshell.c \
|
||||||
eggshell.h \
|
eggshell.h \
|
||||||
profile-editor.c \
|
profile-editor.c \
|
||||||
|
@ -56,17 +56,17 @@ gatuno_terminal_SOURCES= \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if ENABLE_SKEY
|
if ENABLE_SKEY
|
||||||
gatuno_terminal_SOURCES += \
|
mate_terminal_SOURCES += \
|
||||||
skey-popup.c \
|
skey-popup.c \
|
||||||
skey-popup.h \
|
skey-popup.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nodist_gatuno_terminal_SOURCES= $(BUILT_SOURCES)
|
nodist_mate_terminal_SOURCES= $(BUILT_SOURCES)
|
||||||
|
|
||||||
gatuno_terminal_CPPFLAGS = \
|
mate_terminal_CPPFLAGS = \
|
||||||
-DTERMINAL_COMPILATION \
|
-DTERMINAL_COMPILATION \
|
||||||
-DTERMINAL_RESOURCES_PATH_PREFIX="\"/org/gatuno/terminal\"" \
|
-DTERMINAL_RESOURCES_PATH_PREFIX="\"/org/mate/terminal\"" \
|
||||||
-DTERM_DATADIR="\"$(datadir)\"" \
|
-DTERM_DATADIR="\"$(datadir)\"" \
|
||||||
-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
|
-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
|
||||||
-DTERM_PKGDATADIR="\"$(pkgdatadir)\"" \
|
-DTERM_PKGDATADIR="\"$(pkgdatadir)\"" \
|
||||||
|
@ -82,17 +82,30 @@ gatuno_terminal_CPPFLAGS = \
|
||||||
$(DISABLE_DEPRECATED) \
|
$(DISABLE_DEPRECATED) \
|
||||||
$(AM_CPPFLAGS)
|
$(AM_CPPFLAGS)
|
||||||
|
|
||||||
gatuno_terminal_CFLAGS = \
|
mate_terminal_CFLAGS = \
|
||||||
$(TERM_CFLAGS) \
|
$(TERM_CFLAGS) \
|
||||||
$(WARN_CFLAGS) \
|
$(WARN_CFLAGS) \
|
||||||
$(AM_CFLAGS)
|
$(AM_CFLAGS)
|
||||||
|
|
||||||
gatuno_terminal_LDFLAGS = -lICE
|
mate_terminal_LDFLAGS = -lICE
|
||||||
|
|
||||||
gatuno_terminal_LDADD = \
|
mate_terminal_LDADD = \
|
||||||
skey/libskey.la \
|
skey/libskey.la \
|
||||||
$(TERM_LIBS)
|
$(TERM_LIBS)
|
||||||
|
|
||||||
|
mate_terminal_SOURCES += \
|
||||||
|
eggdesktopfile.c \
|
||||||
|
eggdesktopfile.h \
|
||||||
|
eggsmclient.c \
|
||||||
|
eggsmclient.h \
|
||||||
|
eggsmclient-private.h \
|
||||||
|
eggsmclient-xsmp.c \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
mate_terminal_CFLAGS += $(SMCLIENT_CFLAGS)
|
||||||
|
mate_terminal_CPPFLAGS += -DEGG_SM_CLIENT_BACKEND_XSMP
|
||||||
|
mate_terminal_LDADD += $(SMCLIENT_LIBS)
|
||||||
|
|
||||||
TYPES_H_FILES = \
|
TYPES_H_FILES = \
|
||||||
terminal-profile.h \
|
terminal-profile.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -129,10 +142,15 @@ terminal-marshal.c: $(srcdir)/terminal-marshal.list
|
||||||
terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/terminal.gresource.xml)
|
terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/terminal.gresource.xml)
|
||||||
$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $<
|
$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $<
|
||||||
|
|
||||||
##INTLTOOL_XML_NOMERGE_RULE@
|
gsettingsschema_in_files = org.mate.terminal.gschema.xml.in
|
||||||
|
gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
|
||||||
|
.PRECIOUS: $(gsettings_SCHEMAS)
|
||||||
|
@INTLTOOL_XML_NOMERGE_RULE@
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
stamp-terminal-type-builtins.h \
|
stamp-terminal-type-builtins.h \
|
||||||
|
mate-terminal.schemas \
|
||||||
|
$(gsettings_SCHEMAS) \
|
||||||
stamp-terminal-type-builtins.h \
|
stamp-terminal-type-builtins.h \
|
||||||
$(BUILT_SOURCES)
|
$(BUILT_SOURCES)
|
||||||
|
|
||||||
|
@ -153,8 +171,13 @@ EXTRA_DIST = \
|
||||||
extra-strings.c \
|
extra-strings.c \
|
||||||
$(about_DATA) \
|
$(about_DATA) \
|
||||||
$(schema_in_files) \
|
$(schema_in_files) \
|
||||||
|
$(gsettingsschema_in_files) \
|
||||||
$(uimanager_DATA) \
|
$(uimanager_DATA) \
|
||||||
$(builder_DATA) \
|
$(builder_DATA) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
@GSETTINGS_RULES@
|
||||||
|
|
||||||
|
@INTLTOOL_SCHEMAS_RULE@
|
||||||
|
|
||||||
-include $(top_srcdir)/git.mk
|
-include $(top_srcdir)/git.mk
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* eggsmclient-private.h
|
||||||
|
* Copyright (C) 2007 Novell, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EGG_SM_CLIENT_PRIVATE_H__
|
||||||
|
#define __EGG_SM_CLIENT_PRIVATE_H__
|
||||||
|
|
||||||
|
#include "eggsmclient.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
GKeyFile *egg_sm_client_save_state (EggSMClient *client);
|
||||||
|
void egg_sm_client_quit_requested (EggSMClient *client);
|
||||||
|
void egg_sm_client_quit_cancelled (EggSMClient *client);
|
||||||
|
void egg_sm_client_quit (EggSMClient *client);
|
||||||
|
|
||||||
|
GType egg_sm_client_xsmp_get_type (void);
|
||||||
|
EggSMClient *egg_sm_client_xsmp_new (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __EGG_SM_CLIENT_PRIVATE_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,603 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2007 Novell, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
#include "eggsmclient.h"
|
||||||
|
#include "eggsmclient-private.h"
|
||||||
|
|
||||||
|
static void egg_sm_client_debug_handler (const char *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const char *message,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SAVE_STATE,
|
||||||
|
QUIT_REQUESTED,
|
||||||
|
QUIT_CANCELLED,
|
||||||
|
QUIT,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
struct _EggSMClientPrivate
|
||||||
|
{
|
||||||
|
GKeyFile *state_file;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (EggSMClient, egg_sm_client, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static EggSMClient *global_client;
|
||||||
|
static EggSMClientMode global_client_mode = EGG_SM_CLIENT_MODE_NORMAL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
egg_sm_client_init (EggSMClient *client)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
egg_sm_client_class_init (EggSMClientClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EggSMClient::save_state:
|
||||||
|
* @client: the client
|
||||||
|
* @state_file: a #GKeyFile to save state information into
|
||||||
|
*
|
||||||
|
* Emitted when the session manager has requested that the
|
||||||
|
* application save information about its current state. The
|
||||||
|
* application should save its state into @state_file, and then the
|
||||||
|
* session manager may then restart the application in a future
|
||||||
|
* session and tell it to initialize itself from that state.
|
||||||
|
*
|
||||||
|
* You should not save any data into @state_file's "start group"
|
||||||
|
* (ie, the %NULL group). Instead, applications should save their
|
||||||
|
* data into groups with names that start with the application name,
|
||||||
|
* and libraries that connect to this signal should save their data
|
||||||
|
* into groups with names that start with the library name.
|
||||||
|
*
|
||||||
|
* Alternatively, rather than (or in addition to) using @state_file,
|
||||||
|
* the application can save its state by calling
|
||||||
|
* egg_sm_client_set_restart_command() during the processing of this
|
||||||
|
* signal (eg, to include a list of files to open).
|
||||||
|
**/
|
||||||
|
signals[SAVE_STATE] =
|
||||||
|
g_signal_new ("save_state",
|
||||||
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (EggSMClientClass, save_state),
|
||||||
|
NULL, NULL,
|
||||||
|
g_cclosure_marshal_VOID__POINTER,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
1, G_TYPE_POINTER);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EggSMClient::quit_requested:
|
||||||
|
* @client: the client
|
||||||
|
*
|
||||||
|
* Emitted when the session manager requests that the application
|
||||||
|
* exit (generally because the user is logging out). The application
|
||||||
|
* should decide whether or not it is willing to quit (perhaps after
|
||||||
|
* asking the user what to do with documents that have unsaved
|
||||||
|
* changes) and then call egg_sm_client_will_quit(), passing %TRUE
|
||||||
|
* or %FALSE to give its answer to the session manager. (It does not
|
||||||
|
* need to give an answer before returning from the signal handler;
|
||||||
|
* it can interact with the user asynchronously and then give its
|
||||||
|
* answer later on.) If the application does not connect to this
|
||||||
|
* signal, then #EggSMClient will automatically return %TRUE on its
|
||||||
|
* behalf.
|
||||||
|
*
|
||||||
|
* The application should not save its session state as part of
|
||||||
|
* handling this signal; if the user has requested that the session
|
||||||
|
* be saved when logging out, then ::save_state will be emitted
|
||||||
|
* separately.
|
||||||
|
*
|
||||||
|
* If the application agrees to quit, it should then wait for either
|
||||||
|
* the ::quit_cancelled or ::quit signals to be emitted.
|
||||||
|
**/
|
||||||
|
signals[QUIT_REQUESTED] =
|
||||||
|
g_signal_new ("quit_requested",
|
||||||
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (EggSMClientClass, quit_requested),
|
||||||
|
NULL, NULL,
|
||||||
|
g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EggSMClient::quit_cancelled:
|
||||||
|
* @client: the client
|
||||||
|
*
|
||||||
|
* Emitted when the session manager decides to cancel a logout after
|
||||||
|
* the application has already agreed to quit. After receiving this
|
||||||
|
* signal, the application can go back to what it was doing before
|
||||||
|
* receiving the ::quit_requested signal.
|
||||||
|
**/
|
||||||
|
signals[QUIT_CANCELLED] =
|
||||||
|
g_signal_new ("quit_cancelled",
|
||||||
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (EggSMClientClass, quit_cancelled),
|
||||||
|
NULL, NULL,
|
||||||
|
g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EggSMClient::quit:
|
||||||
|
* @client: the client
|
||||||
|
*
|
||||||
|
* Emitted when the session manager wants the application to quit
|
||||||
|
* (generally because the user is logging out). The application
|
||||||
|
* should exit as soon as possible after receiving this signal; if
|
||||||
|
* it does not, the session manager may choose to forcibly kill it.
|
||||||
|
*
|
||||||
|
* Normally a GUI application would only be sent a ::quit if it
|
||||||
|
* agreed to quit in response to a ::quit_requested signal. However,
|
||||||
|
* this is not guaranteed; in some situations the session manager
|
||||||
|
* may decide to end the session without giving applications a
|
||||||
|
* chance to object.
|
||||||
|
**/
|
||||||
|
signals[QUIT] =
|
||||||
|
g_signal_new ("quit",
|
||||||
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (EggSMClientClass, quit),
|
||||||
|
NULL, NULL,
|
||||||
|
g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean sm_client_disable = FALSE;
|
||||||
|
static char *sm_client_state_file = NULL;
|
||||||
|
static char *sm_client_id = NULL;
|
||||||
|
static char *sm_config_prefix = NULL;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
sm_client_post_parse_func (GOptionContext *context,
|
||||||
|
GOptionGroup *group,
|
||||||
|
gpointer data,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
EggSMClient *client = egg_sm_client_get ();
|
||||||
|
|
||||||
|
if (sm_client_id == NULL)
|
||||||
|
{
|
||||||
|
const gchar *desktop_autostart_id;
|
||||||
|
|
||||||
|
desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
|
||||||
|
|
||||||
|
if (desktop_autostart_id != NULL)
|
||||||
|
sm_client_id = g_strdup (desktop_autostart_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to
|
||||||
|
* use the same client id. */
|
||||||
|
g_unsetenv ("DESKTOP_AUTOSTART_ID");
|
||||||
|
|
||||||
|
if (EGG_SM_CLIENT_GET_CLASS (client)->startup)
|
||||||
|
EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_get_option_group:
|
||||||
|
*
|
||||||
|
* Creates a %GOptionGroup containing the session-management-related
|
||||||
|
* options. You should add this group to the application's
|
||||||
|
* %GOptionContext if you want to use #EggSMClient.
|
||||||
|
*
|
||||||
|
* Return value: the %GOptionGroup
|
||||||
|
**/
|
||||||
|
GOptionGroup *
|
||||||
|
egg_sm_client_get_option_group (void)
|
||||||
|
{
|
||||||
|
const GOptionEntry entries[] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"sm-client-disable", 0, 0,
|
||||||
|
G_OPTION_ARG_NONE, &sm_client_disable,
|
||||||
|
N_("Disable connection to session manager"), NULL
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sm-client-state-file", 0, 0,
|
||||||
|
G_OPTION_ARG_FILENAME, &sm_client_state_file,
|
||||||
|
N_("Specify file containing saved configuration"), N_("FILE")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sm-client-id", 0, 0,
|
||||||
|
G_OPTION_ARG_STRING, &sm_client_id,
|
||||||
|
N_("Specify session management ID"), N_("ID")
|
||||||
|
},
|
||||||
|
/* MateClient compatibility option */
|
||||||
|
{
|
||||||
|
"sm-disable", 0, G_OPTION_FLAG_HIDDEN,
|
||||||
|
G_OPTION_ARG_NONE, &sm_client_disable,
|
||||||
|
NULL, NULL
|
||||||
|
},
|
||||||
|
/* MateClient compatibility option. This is a dummy option that only
|
||||||
|
* exists so that sessions saved by apps with MateClient can be restored
|
||||||
|
* later when they've switched to EggSMClient. See bug #575308.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
"sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
|
||||||
|
G_OPTION_ARG_STRING, &sm_config_prefix,
|
||||||
|
NULL, NULL
|
||||||
|
},
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
GOptionGroup *group;
|
||||||
|
|
||||||
|
/* Use our own debug handler for the "EggSMClient" domain. */
|
||||||
|
g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
|
||||||
|
egg_sm_client_debug_handler, NULL);
|
||||||
|
|
||||||
|
group = g_option_group_new ("sm-client",
|
||||||
|
_("Session management options:"),
|
||||||
|
_("Show session management options"),
|
||||||
|
NULL, NULL);
|
||||||
|
g_option_group_add_entries (group, entries);
|
||||||
|
g_option_group_set_parse_hooks (group, NULL, sm_client_post_parse_func);
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_set_mode:
|
||||||
|
* @mode: an #EggSMClient mode
|
||||||
|
*
|
||||||
|
* Sets the "mode" of #EggSMClient as follows:
|
||||||
|
*
|
||||||
|
* %EGG_SM_CLIENT_MODE_DISABLED: Session management is completely
|
||||||
|
* disabled. The application will not even connect to the session
|
||||||
|
* manager. (egg_sm_client_get() will still return an #EggSMClient,
|
||||||
|
* but it will just be a dummy object.)
|
||||||
|
*
|
||||||
|
* %EGG_SM_CLIENT_MODE_NO_RESTART: The application will connect to
|
||||||
|
* the session manager (and thus will receive notification when the
|
||||||
|
* user is logging out, etc), but will request to not be
|
||||||
|
* automatically restarted with saved state in future sessions.
|
||||||
|
*
|
||||||
|
* %EGG_SM_CLIENT_MODE_NORMAL: The default. #EggSMCLient will
|
||||||
|
* function normally.
|
||||||
|
*
|
||||||
|
* This must be called before the application's main loop begins.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
egg_sm_client_set_mode (EggSMClientMode mode)
|
||||||
|
{
|
||||||
|
global_client_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_get_mode:
|
||||||
|
*
|
||||||
|
* Gets the global #EggSMClientMode. See egg_sm_client_set_mode()
|
||||||
|
* for details.
|
||||||
|
*
|
||||||
|
* Return value: the global #EggSMClientMode
|
||||||
|
**/
|
||||||
|
EggSMClientMode
|
||||||
|
egg_sm_client_get_mode (void)
|
||||||
|
{
|
||||||
|
return global_client_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_get:
|
||||||
|
*
|
||||||
|
* Returns the master #EggSMClient for the application.
|
||||||
|
*
|
||||||
|
* On platforms that support saved sessions (ie, POSIX/X11), the
|
||||||
|
* application will only request to be restarted by the session
|
||||||
|
* manager if you call egg_set_desktop_file() to set an application
|
||||||
|
* desktop file. In particular, if the desktop file contains the key
|
||||||
|
* "X
|
||||||
|
*
|
||||||
|
* Return value: the master #EggSMClient.
|
||||||
|
**/
|
||||||
|
EggSMClient *
|
||||||
|
egg_sm_client_get (void)
|
||||||
|
{
|
||||||
|
if (!global_client)
|
||||||
|
{
|
||||||
|
if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
|
||||||
|
!sm_client_disable)
|
||||||
|
{
|
||||||
|
global_client = egg_sm_client_xsmp_new ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fallback: create a dummy client, so that callers don't have
|
||||||
|
* to worry about a %NULL return value.
|
||||||
|
*/
|
||||||
|
if (!global_client)
|
||||||
|
global_client = g_object_new (EGG_TYPE_SM_CLIENT, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return global_client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_is_resumed:
|
||||||
|
* @client: the client
|
||||||
|
*
|
||||||
|
* Checks whether or not the current session has been resumed from
|
||||||
|
* a previous saved session. If so, the application should call
|
||||||
|
* egg_sm_client_get_state_file() and restore its state from the
|
||||||
|
* returned #GKeyFile.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the session has been resumed
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
egg_sm_client_is_resumed (EggSMClient *client)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (client == global_client, FALSE);
|
||||||
|
|
||||||
|
return sm_client_state_file != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_get_state_file:
|
||||||
|
* @client: the client
|
||||||
|
*
|
||||||
|
* If the application was resumed by the session manager, this will
|
||||||
|
* return the #GKeyFile containing its state from the previous
|
||||||
|
* session.
|
||||||
|
*
|
||||||
|
* Note that other libraries and #EggSMClient itself may also store
|
||||||
|
* state in the key file, so if you call egg_sm_client_get_groups(),
|
||||||
|
* on it, the return value will likely include groups that you did not
|
||||||
|
* put there yourself. (It is also not guaranteed that the first
|
||||||
|
* group created by the application will still be the "start group"
|
||||||
|
* when it is resumed.)
|
||||||
|
*
|
||||||
|
* Return value: the #GKeyFile containing the application's earlier
|
||||||
|
* state, or %NULL on error. You should not free this key file; it
|
||||||
|
* is owned by @client.
|
||||||
|
**/
|
||||||
|
GKeyFile *
|
||||||
|
egg_sm_client_get_state_file (EggSMClient *client)
|
||||||
|
{
|
||||||
|
EggSMClientPrivate *priv = egg_sm_client_get_instance_private (client);
|
||||||
|
char *state_file_path;
|
||||||
|
GError *err = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (client == global_client, NULL);
|
||||||
|
|
||||||
|
if (!sm_client_state_file)
|
||||||
|
return NULL;
|
||||||
|
if (priv->state_file)
|
||||||
|
return priv->state_file;
|
||||||
|
|
||||||
|
if (!strncmp (sm_client_state_file, "file://", 7))
|
||||||
|
state_file_path = g_filename_from_uri (sm_client_state_file, NULL, NULL);
|
||||||
|
else
|
||||||
|
state_file_path = g_strdup (sm_client_state_file);
|
||||||
|
|
||||||
|
priv->state_file = g_key_file_new ();
|
||||||
|
if (!g_key_file_load_from_file (priv->state_file, state_file_path, 0, &err))
|
||||||
|
{
|
||||||
|
g_warning ("Could not load SM state file '%s': %s",
|
||||||
|
sm_client_state_file, err->message);
|
||||||
|
g_clear_error (&err);
|
||||||
|
g_key_file_free (priv->state_file);
|
||||||
|
priv->state_file = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (state_file_path);
|
||||||
|
return priv->state_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_set_restart_command:
|
||||||
|
* @client: the client
|
||||||
|
* @argc: the length of @argv
|
||||||
|
* @argv: argument vector
|
||||||
|
*
|
||||||
|
* Sets the command used to restart @client if it does not have a
|
||||||
|
* .desktop file that can be used to find its restart command.
|
||||||
|
*
|
||||||
|
* This can also be used when handling the ::save_state signal, to
|
||||||
|
* save the current state via an updated command line. (Eg, providing
|
||||||
|
* a list of filenames to open when the application is resumed.)
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
egg_sm_client_set_restart_command (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv)
|
||||||
|
{
|
||||||
|
g_return_if_fail (EGG_IS_SM_CLIENT (client));
|
||||||
|
|
||||||
|
if (EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command)
|
||||||
|
EGG_SM_CLIENT_GET_CLASS (client)->set_restart_command (client, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_set_discard_command:
|
||||||
|
* @client: the client
|
||||||
|
* @argc: the length of @argv
|
||||||
|
* @argv: argument vector
|
||||||
|
*
|
||||||
|
* Sets the command used to discard a custom state file if using
|
||||||
|
* egg_sm_client_set_restart_command(), which must be called before
|
||||||
|
* using this function.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
egg_sm_client_set_discard_command (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv)
|
||||||
|
{
|
||||||
|
g_return_if_fail (EGG_IS_SM_CLIENT (client));
|
||||||
|
|
||||||
|
if (EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command)
|
||||||
|
EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command (client, argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_will_quit:
|
||||||
|
* @client: the client
|
||||||
|
* @will_quit: whether or not the application is willing to quit
|
||||||
|
*
|
||||||
|
* This MUST be called in response to the ::quit_requested signal, to
|
||||||
|
* indicate whether or not the application is willing to quit. The
|
||||||
|
* application may call it either directly from the signal handler, or
|
||||||
|
* at some later point (eg, after asynchronously interacting with the
|
||||||
|
* user).
|
||||||
|
*
|
||||||
|
* If the application does not connect to ::quit_requested,
|
||||||
|
* #EggSMClient will call this method on its behalf (passing %TRUE
|
||||||
|
* for @will_quit).
|
||||||
|
*
|
||||||
|
* After calling this method, the application should wait to receive
|
||||||
|
* either ::quit_cancelled or ::quit.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
egg_sm_client_will_quit (EggSMClient *client,
|
||||||
|
gboolean will_quit)
|
||||||
|
{
|
||||||
|
g_return_if_fail (EGG_IS_SM_CLIENT (client));
|
||||||
|
|
||||||
|
if (EGG_SM_CLIENT_GET_CLASS (client)->will_quit)
|
||||||
|
EGG_SM_CLIENT_GET_CLASS (client)->will_quit (client, will_quit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* egg_sm_client_end_session:
|
||||||
|
* @style: a hint at how to end the session
|
||||||
|
* @request_confirmation: whether or not the user should get a chance
|
||||||
|
* to confirm the action
|
||||||
|
*
|
||||||
|
* Requests that the session manager end the current session. @style
|
||||||
|
* indicates how the session should be ended, and
|
||||||
|
* @request_confirmation indicates whether or not the user should be
|
||||||
|
* given a chance to confirm the logout/reboot/shutdown. Both of these
|
||||||
|
* flags are merely hints though; the session manager may choose to
|
||||||
|
* ignore them.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the request was sent; %FALSE if it could not
|
||||||
|
* be (eg, because it could not connect to the session manager).
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
egg_sm_client_end_session (EggSMClientEndStyle style,
|
||||||
|
gboolean request_confirmation)
|
||||||
|
{
|
||||||
|
EggSMClient *client = egg_sm_client_get ();
|
||||||
|
|
||||||
|
g_return_val_if_fail (EGG_IS_SM_CLIENT (client), FALSE);
|
||||||
|
|
||||||
|
if (EGG_SM_CLIENT_GET_CLASS (client)->end_session)
|
||||||
|
{
|
||||||
|
return EGG_SM_CLIENT_GET_CLASS (client)->end_session (client, style,
|
||||||
|
request_confirmation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Signal-emitting callbacks from platform-specific code */
|
||||||
|
|
||||||
|
GKeyFile *
|
||||||
|
egg_sm_client_save_state (EggSMClient *client)
|
||||||
|
{
|
||||||
|
GKeyFile *state_file;
|
||||||
|
char *group;
|
||||||
|
|
||||||
|
g_return_val_if_fail (client == global_client, NULL);
|
||||||
|
|
||||||
|
state_file = g_key_file_new ();
|
||||||
|
|
||||||
|
g_debug ("Emitting save_state");
|
||||||
|
g_signal_emit (client, signals[SAVE_STATE], 0, state_file);
|
||||||
|
g_debug ("Done emitting save_state");
|
||||||
|
|
||||||
|
group = g_key_file_get_start_group (state_file);
|
||||||
|
if (group)
|
||||||
|
{
|
||||||
|
g_free (group);
|
||||||
|
return state_file;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_key_file_free (state_file);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
egg_sm_client_quit_requested (EggSMClient *client)
|
||||||
|
{
|
||||||
|
g_return_if_fail (client == global_client);
|
||||||
|
|
||||||
|
if (!g_signal_has_handler_pending (client, signals[QUIT_REQUESTED], 0, FALSE))
|
||||||
|
{
|
||||||
|
g_debug ("Not emitting quit_requested because no one is listening");
|
||||||
|
egg_sm_client_will_quit (client, TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_debug ("Emitting quit_requested");
|
||||||
|
g_signal_emit (client, signals[QUIT_REQUESTED], 0);
|
||||||
|
g_debug ("Done emitting quit_requested");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
egg_sm_client_quit_cancelled (EggSMClient *client)
|
||||||
|
{
|
||||||
|
g_return_if_fail (client == global_client);
|
||||||
|
|
||||||
|
g_debug ("Emitting quit_cancelled");
|
||||||
|
g_signal_emit (client, signals[QUIT_CANCELLED], 0);
|
||||||
|
g_debug ("Done emitting quit_cancelled");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
egg_sm_client_quit (EggSMClient *client)
|
||||||
|
{
|
||||||
|
g_return_if_fail (client == global_client);
|
||||||
|
|
||||||
|
g_debug ("Emitting quit");
|
||||||
|
g_signal_emit (client, signals[QUIT], 0);
|
||||||
|
g_debug ("Done emitting quit");
|
||||||
|
|
||||||
|
/* FIXME: should we just call gtk_main_quit() here? */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
egg_sm_client_debug_handler (const char *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const char *message,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
static int debug = -1;
|
||||||
|
|
||||||
|
if (debug < 0)
|
||||||
|
debug = (g_getenv ("EGG_SM_CLIENT_DEBUG") != NULL);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
g_log_default_handler (log_domain, log_level, message, NULL);
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
/* eggsmclient.h
|
||||||
|
* Copyright (C) 2007 Novell, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EGG_SM_CLIENT_H__
|
||||||
|
#define __EGG_SM_CLIENT_H__
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define EGG_TYPE_SM_CLIENT (egg_sm_client_get_type ())
|
||||||
|
#define EGG_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT, EggSMClient))
|
||||||
|
#define EGG_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_SM_CLIENT, EggSMClientClass))
|
||||||
|
#define EGG_IS_SM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_SM_CLIENT))
|
||||||
|
#define EGG_IS_SM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_SM_CLIENT))
|
||||||
|
#define EGG_SM_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_SM_CLIENT, EggSMClientClass))
|
||||||
|
|
||||||
|
typedef struct _EggSMClient EggSMClient;
|
||||||
|
typedef struct _EggSMClientClass EggSMClientClass;
|
||||||
|
typedef struct _EggSMClientPrivate EggSMClientPrivate;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
EGG_SM_CLIENT_END_SESSION_DEFAULT,
|
||||||
|
EGG_SM_CLIENT_LOGOUT,
|
||||||
|
EGG_SM_CLIENT_REBOOT,
|
||||||
|
EGG_SM_CLIENT_SHUTDOWN
|
||||||
|
} EggSMClientEndStyle;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
EGG_SM_CLIENT_MODE_DISABLED,
|
||||||
|
EGG_SM_CLIENT_MODE_NO_RESTART,
|
||||||
|
EGG_SM_CLIENT_MODE_NORMAL
|
||||||
|
} EggSMClientMode;
|
||||||
|
|
||||||
|
struct _EggSMClient
|
||||||
|
{
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _EggSMClientClass
|
||||||
|
{
|
||||||
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
/* signals */
|
||||||
|
void (*save_state) (EggSMClient *client,
|
||||||
|
GKeyFile *state_file);
|
||||||
|
|
||||||
|
void (*quit_requested) (EggSMClient *client);
|
||||||
|
void (*quit_cancelled) (EggSMClient *client);
|
||||||
|
void (*quit) (EggSMClient *client);
|
||||||
|
|
||||||
|
/* virtual methods */
|
||||||
|
void (*startup) (EggSMClient *client,
|
||||||
|
const char *client_id);
|
||||||
|
void (*set_restart_command) (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv);
|
||||||
|
void (*set_discard_command) (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv);
|
||||||
|
void (*will_quit) (EggSMClient *client,
|
||||||
|
gboolean will_quit);
|
||||||
|
gboolean (*end_session) (EggSMClient *client,
|
||||||
|
EggSMClientEndStyle style,
|
||||||
|
gboolean request_confirmation);
|
||||||
|
|
||||||
|
/* Padding for future expansion */
|
||||||
|
void (*_egg_reserved1) (void);
|
||||||
|
void (*_egg_reserved2) (void);
|
||||||
|
void (*_egg_reserved3) (void);
|
||||||
|
void (*_egg_reserved4) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
GType egg_sm_client_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GOptionGroup *egg_sm_client_get_option_group (void);
|
||||||
|
|
||||||
|
/* Initialization */
|
||||||
|
void egg_sm_client_set_mode (EggSMClientMode mode);
|
||||||
|
EggSMClientMode egg_sm_client_get_mode (void);
|
||||||
|
EggSMClient *egg_sm_client_get (void);
|
||||||
|
|
||||||
|
/* Resuming a saved session */
|
||||||
|
gboolean egg_sm_client_is_resumed (EggSMClient *client);
|
||||||
|
GKeyFile *egg_sm_client_get_state_file (EggSMClient *client);
|
||||||
|
|
||||||
|
/* Alternate means of saving state */
|
||||||
|
void egg_sm_client_set_restart_command (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv);
|
||||||
|
void egg_sm_client_set_discard_command (EggSMClient *client,
|
||||||
|
int argc,
|
||||||
|
const char **argv);
|
||||||
|
|
||||||
|
/* Handling "quit_requested" signal */
|
||||||
|
void egg_sm_client_will_quit (EggSMClient *client,
|
||||||
|
gboolean will_quit);
|
||||||
|
|
||||||
|
/* Initiate a logout/reboot/shutdown */
|
||||||
|
gboolean egg_sm_client_end_session (EggSMClientEndStyle style,
|
||||||
|
gboolean request_confirmation);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __EGG_SM_CLIENT_H__ */
|
|
@ -12,7 +12,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="title" translatable="yes">Keyboard Shortcuts</property>
|
<property name="title" translatable="yes">Keyboard Shortcuts</property>
|
||||||
<property name="role">gatuno-terminal-accels</property>
|
<property name="role">mate-terminal-accels</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox" id="dialog-vbox2">
|
<object class="GtkBox" id="dialog-vbox2">
|
||||||
|
|
|
@ -0,0 +1,484 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
|
||||||
|
<enum id="org.mate.terminal.erasebinding">
|
||||||
|
<value nick="auto" value="0"/>
|
||||||
|
<value nick="control-h" value="1"/>
|
||||||
|
<value nick="ascii-del" value="2"/>
|
||||||
|
<value nick="escape-sequence" value="3"/>
|
||||||
|
<value nick="tty" value="4"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.titlemode">
|
||||||
|
<value nick="replace" value="0"/>
|
||||||
|
<value nick="before" value="1"/>
|
||||||
|
<value nick="after" value="2"/>
|
||||||
|
<value nick="ignore" value="3"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.scrollbar-position">
|
||||||
|
<value nick="left" value="0"/>
|
||||||
|
<value nick="right" value="1"/>
|
||||||
|
<value nick="hidden" value="2"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.exit-action">
|
||||||
|
<value nick="close" value="0"/>
|
||||||
|
<value nick="restart" value="1"/>
|
||||||
|
<value nick="hold" value="2"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.cursor-shape">
|
||||||
|
<value nick="block" value="0"/>
|
||||||
|
<value nick="ibeam" value="1"/>
|
||||||
|
<value nick="underline" value="2"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.cursor-blink-mode">
|
||||||
|
<value nick="system" value="0"/>
|
||||||
|
<value nick="on" value="1"/>
|
||||||
|
<value nick="off" value="2"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.mate.terminal.background-type">
|
||||||
|
<value nick="solid" value="0"/>
|
||||||
|
<value nick="image" value="1"/>
|
||||||
|
<value nick="transparent" value="2"/>
|
||||||
|
</enum>
|
||||||
|
<schema id="org.mate.terminal" path="/org/mate/terminal/">
|
||||||
|
<child name="global" schema="org.mate.terminal.global"/>
|
||||||
|
<child name="profiles" schema="org.mate.terminal.profiles"/>
|
||||||
|
<child name="keybindings" schema="org.mate.terminal.keybindings"/>
|
||||||
|
</schema>
|
||||||
|
<schema id="org.mate.terminal.global" path="/org/mate/terminal/global/">
|
||||||
|
<key name="profile-list" type="as">
|
||||||
|
<default>[ 'default' ]</default>
|
||||||
|
<summary>List of profiles</summary>
|
||||||
|
<description>List of profiles known to mate-terminal. The list contains strings naming subdirectories relative to /org/mate/terminal/profiles.</description>
|
||||||
|
</key>
|
||||||
|
<key name="default-profile" type="s">
|
||||||
|
<default>'default'</default>
|
||||||
|
<summary>Profile to use for new terminals</summary>
|
||||||
|
<description>Profile to be used when opening a new window or tab. Must be in profile_list.</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-mnemonics" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether the menubar has access keys</summary>
|
||||||
|
<description>Whether to have Alt+letter access keys for the menubar. They may interfere with some applications run inside the terminal so it's possible to turn them off.</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-menu-accelerators" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether the standard GTK+ shortcut for menubar access is enabled</summary>
|
||||||
|
<description>Normally you can access the menubar with F10. This can also be customized via gtkrc (gtk-menu-bar-accel = "whatever"). This option allows the standard menubar accelerator to be disabled.</description>
|
||||||
|
</key>
|
||||||
|
<key name="active-encodings" type="as">
|
||||||
|
<default context="active-encodings" l10n="messages">[ 'UTF-8', 'current' ]</default>
|
||||||
|
<summary>List of available encodings</summary>
|
||||||
|
<description>A subset of possible encodings are presented in the "Encoding" submenu. This is a list of encodings to appear there. The special encoding name "current" means to display the encoding of the current locale.</description>
|
||||||
|
</key>
|
||||||
|
<key name="confirm-window-close" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to ask for confirmation when closing terminal windows</summary>
|
||||||
|
<description>Whether to ask for confirmation when closing a terminal window which has more than one open tab or any foreground subprocesses.</description>
|
||||||
|
</key>
|
||||||
|
<key name="middle-click-closes-tabs" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Close tabs with middle click</summary>
|
||||||
|
<description>If true, it enables the ability to close tabs using middle click.</description>
|
||||||
|
</key>
|
||||||
|
<key name="ctrl-tab-switch-tabs" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Switch tabs with [Ctrl]+[Tab]</summary>
|
||||||
|
<description>If true, it enables the ability to switch tabs using [Ctrl+Tab] and [Ctrl+Shift+Tab].</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
<schema id="org.mate.terminal.profiles" path="/org/mate/terminal/profiles/">
|
||||||
|
</schema>
|
||||||
|
<schema id="org.mate.terminal.profile">
|
||||||
|
<key name="visible-name" type="s">
|
||||||
|
<default context="visible-name" l10n="messages">'Default'</default>
|
||||||
|
<summary>Human-readable name of the profile</summary>
|
||||||
|
<description>Human-readable name of the profile.</description>
|
||||||
|
</key>
|
||||||
|
<key name="default-show-menubar" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to show menubar in new windows/tabs</summary>
|
||||||
|
<description>True if the menubar should be shown in new windows, for windows/tabs with this profile.</description>
|
||||||
|
</key>
|
||||||
|
<key name="foreground-color" type="s">
|
||||||
|
<default>'#000000'</default>
|
||||||
|
<summary>Default color of text in the terminal</summary>
|
||||||
|
<description>Default color of text in the terminal, as a color specification (can be HTML-style hex digits, or a color name such as "red").</description>
|
||||||
|
</key>
|
||||||
|
<key name="background-color" type="s">
|
||||||
|
<default>'#FFFFDD'</default>
|
||||||
|
<summary>Default color of terminal background</summary>
|
||||||
|
<description>Default color of terminal background, as a color specification (can be HTML-style hex digits, or a color name such as "red").</description>
|
||||||
|
</key>
|
||||||
|
<key name="bold-color" type="s">
|
||||||
|
<default>'#000000'</default>
|
||||||
|
<summary>Default color of bold text in the terminal</summary>
|
||||||
|
<description>Default color of bold text in the terminal, as a color specification (can be HTML-style hex digits, or a color name such as "red"). This is ignored if bold_color_same_as_fg is true.</description>
|
||||||
|
</key>
|
||||||
|
<key name="bold-color-same-as-fg" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether bold text should use the same color as normal text</summary>
|
||||||
|
<description>If true, boldface text will be rendered using the same color as normal text.</description>
|
||||||
|
</key>
|
||||||
|
<key name="title-mode" enum="org.mate.terminal.titlemode">
|
||||||
|
<default>'replace'</default>
|
||||||
|
<summary>What to do with dynamic title</summary>
|
||||||
|
<description>If the application in the terminal sets the title (most typically people have their shell set up to do this), the dynamically-set title can erase the configured title, go before it, go after it, or replace it. The possible values are "replace", "before", "after", and "ignore".</description>
|
||||||
|
</key>
|
||||||
|
<key name="title" type="s">
|
||||||
|
<default context="title" l10n="messages">'Terminal'</default>
|
||||||
|
<summary>Title for terminal</summary>
|
||||||
|
<description>Title to display for the terminal window or tab. This title may be replaced by or combined with the title set by the application inside the terminal, depending on the title_mode setting.</description>
|
||||||
|
</key>
|
||||||
|
<key name="allow-bold" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to allow bold text</summary>
|
||||||
|
<description>If true, allow applications in the terminal to make text boldface.</description>
|
||||||
|
</key>
|
||||||
|
<key name="silent-bell" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether to silence terminal bell</summary>
|
||||||
|
<description>If true, don't make a noise when applications send the escape sequence for the terminal bell.</description>
|
||||||
|
</key>
|
||||||
|
<key name="copy-selection" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Copy selection to clipboard</summary>
|
||||||
|
<description>If true, selection is automatically copied to clipboard buffer.</description>
|
||||||
|
</key>
|
||||||
|
<key name="word-chars" type="s">
|
||||||
|
<default>'-A-Za-z0-9,./?%&#:_=+@~'</default>
|
||||||
|
<summary>Characters that are considered "part of a word"</summary>
|
||||||
|
<description>When selecting text by word, sequences of these characters are considered single words. Ranges can be given as "A-Z". Literal hyphen (not expressing a range) should be the first character given.</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-custom-default-size" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether to use custom terminal size for new windows</summary>
|
||||||
|
<description>If true, newly created terminal windows will have custom size specified by default_size_columns and default_size_rows.</description>
|
||||||
|
</key>
|
||||||
|
<key name="default-size-columns" type="i">
|
||||||
|
<default>80</default>
|
||||||
|
<summary>Default number of columns</summary>
|
||||||
|
<description>Number of columns in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.</description>
|
||||||
|
</key>
|
||||||
|
<key name="default-size-rows" type="i">
|
||||||
|
<default>24</default>
|
||||||
|
<summary>Default number of rows</summary>
|
||||||
|
<description>Number of rows in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.</description>
|
||||||
|
</key>
|
||||||
|
<key name="scrollbar-position" enum="org.mate.terminal.scrollbar-position">
|
||||||
|
<default>'right'</default>
|
||||||
|
<summary>Position of the scrollbar</summary>
|
||||||
|
<description>Where to put the terminal scrollbar. Possibilities are "left", "right", and "hidden".</description>
|
||||||
|
</key>
|
||||||
|
<key name="scrollback-lines" type="i">
|
||||||
|
<default>512</default>
|
||||||
|
<summary>Number of lines to keep in scrollback</summary>
|
||||||
|
<description>Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. If scrollback_unlimited is true, this value is ignored.</description>
|
||||||
|
</key>
|
||||||
|
<key name="scrollback-unlimited" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether an unlimited number of lines should be kept in scrollback</summary>
|
||||||
|
<description>If true, scrollback lines will never be discarded. The scrollback history is stored on disk temporarily, so this may cause the system to run out of disk space if there is a lot of output to the terminal.</description>
|
||||||
|
</key>
|
||||||
|
<key name="scroll-on-keystroke" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to scroll to the bottom when a key is pressed</summary>
|
||||||
|
<description>If true, pressing a key jumps the scrollbar to the bottom.</description>
|
||||||
|
</key>
|
||||||
|
<key name="scroll-on-output" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether to scroll to the bottom when there's new output</summary>
|
||||||
|
<description>If true, whenever there's new output the terminal will scroll to the bottom.</description>
|
||||||
|
</key>
|
||||||
|
<key name="exit-action" enum="org.mate.terminal.exit-action">
|
||||||
|
<default>'close'</default>
|
||||||
|
<summary>What to do with the terminal when the child command exits</summary>
|
||||||
|
<description>Possible values are "close" to close the terminal, and "restart" to restart the command.</description>
|
||||||
|
</key>
|
||||||
|
<key name="login-shell" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether to launch the command in the terminal as a login shell</summary>
|
||||||
|
<description>If true, the command inside the terminal will be launched as a login shell. (argv[0] will have a hyphen in front of it.)</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-custom-command" type="b">
|
||||||
|
<default>false</default>
|
||||||
|
<summary>Whether to run a custom command instead of the shell</summary>
|
||||||
|
<description>If true, the value of the custom_command setting will be used in place of running a shell.</description>
|
||||||
|
</key>
|
||||||
|
<key name="cursor-blink-mode" enum="org.mate.terminal.cursor-blink-mode">
|
||||||
|
<default>'system'</default>
|
||||||
|
<summary>Whether to blink the cursor</summary>
|
||||||
|
<description>The possible values are "system" to use the global cursor blinking settings, or "on" or "off" to set the mode explicitly.</description>
|
||||||
|
</key>
|
||||||
|
<key name="cursor-shape" enum="org.mate.terminal.cursor-shape">
|
||||||
|
<default>'block'</default>
|
||||||
|
<summary>The cursor appearance</summary>
|
||||||
|
<description>The possible values are "block" to use a block cursor, "ibeam" to use a vertical line cursor, or "underline" to use an underline cursor.</description>
|
||||||
|
</key>
|
||||||
|
<key name="custom-command" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Custom command to use instead of the shell</summary>
|
||||||
|
<description>Run this command in place of the shell, if use_custom_command is true.</description>
|
||||||
|
</key>
|
||||||
|
<key name="icon" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Icon for terminal window</summary>
|
||||||
|
<description>Icon to use for tabs/windows containing this profile.</description>
|
||||||
|
</key>
|
||||||
|
<key name="palette" type="s">
|
||||||
|
<default>'#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC'</default>
|
||||||
|
<summary>Palette for terminal applications</summary>
|
||||||
|
<description>Terminals have a 16-color palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of color names. Color names should be in hex format e.g. "#FF00FF"</description>
|
||||||
|
</key>
|
||||||
|
<key name="font" type="s">
|
||||||
|
<default>'Monospace 12'</default>
|
||||||
|
<summary>Font</summary>
|
||||||
|
<description>An Pango font name. Examples are "Sans 12" or "Monospace Bold 14".</description>
|
||||||
|
</key>
|
||||||
|
<key name="background-type" enum="org.mate.terminal.background-type">
|
||||||
|
<default>'solid'</default>
|
||||||
|
<summary>Background type</summary>
|
||||||
|
<description>Type of terminal background. May be "solid" for a solid color, "image" for an image, or "transparent" for either real transparency if a compositing window manager is running, or pseudo-transparency otherwise.</description>
|
||||||
|
</key>
|
||||||
|
<key name="background-image" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Background image</summary>
|
||||||
|
<description>Filename of a background image.</description>
|
||||||
|
</key>
|
||||||
|
<key name="scroll-background" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to scroll background image</summary>
|
||||||
|
<description>If true, scroll the background image with the foreground text; if false, keep the image in a fixed position and scroll the text above it.</description>
|
||||||
|
</key>
|
||||||
|
<key name="background-darkness" type="d">
|
||||||
|
<default>0.5</default>
|
||||||
|
<summary>How much to darken the background image</summary>
|
||||||
|
<description>A value between 0.0 and 1.0 indicating how much to darken the background image. 0.0 means no darkness, 1.0 means fully dark. In the current implementation, there are only two levels of darkness possible, so the setting behaves as a boolean, where 0.0 disables the darkening effect.</description>
|
||||||
|
</key>
|
||||||
|
<key name="backspace-binding" enum="org.mate.terminal.erasebinding">
|
||||||
|
<default>'ascii-del'</default>
|
||||||
|
<summary>Effect of the Backspace key</summary>
|
||||||
|
<description>Sets what code the backspace key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "ascii-del" is normally considered the correct setting for the Backspace key.</description>
|
||||||
|
</key>
|
||||||
|
<key name="delete-binding" enum="org.mate.terminal.erasebinding">
|
||||||
|
<default>'escape-sequence'</default>
|
||||||
|
<summary>Effect of the Delete key</summary>
|
||||||
|
<description>Sets what code the delete key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "escape-sequence" is normally considered the correct setting for the Delete key.</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-theme-colors" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to use the colors from the theme for the terminal widget</summary>
|
||||||
|
<description>If true, the theme color scheme used for text entry boxes will be used for the terminal, instead of colors provided by the user.</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-system-font" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Whether to use the system font</summary>
|
||||||
|
<description>If true, the terminal will use the desktop-global standard font if it's monospace (and the most similar font it can come up with otherwise).</description>
|
||||||
|
</key>
|
||||||
|
<key name="use-skey" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Highlight S/Key challenges</summary>
|
||||||
|
<description>Popup a dialog when an S/Key challenge response query is detected and clicked on. Typing a password into the dialog will send it to the terminal.</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
<schema id="org.mate.terminal.keybindings" path="/org/mate/terminal/keybindings/">
|
||||||
|
<key name="new-tab" type="s">
|
||||||
|
<default>'<Ctrl><Shift>t'</default>
|
||||||
|
<summary>Keyboard shortcut to open a new tab</summary>
|
||||||
|
<description>Keyboard shortcut key for opening a new tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="new-window" type="s">
|
||||||
|
<default>'<Ctrl><Shift>n'</default>
|
||||||
|
<summary>Keyboard shortcut to open a new window</summary>
|
||||||
|
<description>Keyboard shortcut key for opening a new window. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="new-profile" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to create a new profile</summary>
|
||||||
|
<description>Keyboard shortcut key for bringing up the dialog for profile creation. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="save-contents" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to save the current tab contents to file</summary>
|
||||||
|
<description>Keyboard shortcut key to save the current tab contents to a file. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="close-tab" type="s">
|
||||||
|
<default>'<Ctrl><Shift>w'</default>
|
||||||
|
<summary>Keyboard shortcut to close a tab</summary>
|
||||||
|
<description>Keyboard shortcut key for closing a tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="close-window" type="s">
|
||||||
|
<default>'<Ctrl><Shift>q'</default>
|
||||||
|
<summary>Keyboard shortcut to close a window</summary>
|
||||||
|
<description>Keyboard shortcut key for closing a window. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="copy" type="s">
|
||||||
|
<default>'<Ctrl><Shift>c'</default>
|
||||||
|
<summary>Keyboard shortcut to copy text</summary>
|
||||||
|
<description>Keyboard shortcut key for copying selected text to the clipboard. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="paste" type="s">
|
||||||
|
<default>'<Ctrl><Shift>v'</default>
|
||||||
|
<summary>Keyboard shortcut to paste text</summary>
|
||||||
|
<description>Keyboard shortcut key for pasting the contents of the clipboard in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="select-all" type="s">
|
||||||
|
<default>'<Ctrl><Shift>a'</default>
|
||||||
|
<summary>Keyboard shortcut to select all text</summary>
|
||||||
|
<description>Keyboard shortcut key for selecting all the text in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="search-find" type="s">
|
||||||
|
<default>'<Ctrl><Shift>f'</default>
|
||||||
|
<summary>Keyboard shortcut to show the find dialog</summary>
|
||||||
|
<description>Keyboard shortcut key for showing the find dialog. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="search-find-next" type="s">
|
||||||
|
<default>'<Ctrl><Shift>h'</default>
|
||||||
|
<summary>Keyboard shortcut to find the next occurrence of the search term</summary>
|
||||||
|
<description>Keyboard shortcut key for finding the next occurrence of the search term in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="search-find-previous" type="s">
|
||||||
|
<default>'<Ctrl><Shift>g'</default>
|
||||||
|
<summary>Keyboard shortcut to find the previous occurrence of the search term</summary>
|
||||||
|
<description>Keyboard shortcut key for finding the previous occurrence of the search term in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="full-screen" type="s">
|
||||||
|
<default>'F11'</default>
|
||||||
|
<summary>Keyboard shortcut to toggle full screen mode</summary>
|
||||||
|
<description>Keyboard shortcut key for toggling full screen mode. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="toggle-menubar" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to toggle the visibility of the menubar</summary>
|
||||||
|
<description>Keyboard shortcut key to toggle the visibility of the menubar. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="set-terminal-title" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to set the terminal title</summary>
|
||||||
|
<description>Keyboard shortcut key to set the terminal title. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="reset" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to reset the terminal</summary>
|
||||||
|
<description>Keyboard shortcut key to reset the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="reset-and-clear" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to reset and clear the terminal</summary>
|
||||||
|
<description>Keyboard shortcut key to reset and clear the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="prev-tab" type="s">
|
||||||
|
<default>'<Control>Page_Up'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to the previous tab</summary>
|
||||||
|
<description>Keyboard shortcut key to switch to the previous tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="next-tab" type="s">
|
||||||
|
<default>'<Control>Page_Down'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to the next tab</summary>
|
||||||
|
<description>Keyboard shortcut key to switch to the next tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="prev-profile" type="s">
|
||||||
|
<default>'<Alt>Page_Up'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to the previous profile</summary>
|
||||||
|
<description>Keyboard shortcut key to switch to the previous profile. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="next-profile" type="s">
|
||||||
|
<default>'<Alt>Page_Down'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to the next profile</summary>
|
||||||
|
<description>Keyboard shortcut key to switch to the next profile. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="move-tab-left" type="s">
|
||||||
|
<default>'<Ctrl><Shift>Page_Up'</default>
|
||||||
|
<summary>Accelerator to move the current tab to the left.</summary>
|
||||||
|
<description>Accelerator key to move the current tab to the left. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="move-tab-right" type="s">
|
||||||
|
<default>'<Ctrl><Shift>Page_Down'</default>
|
||||||
|
<summary>Accelerator to move the current tab to the right.</summary>
|
||||||
|
<description>Accelerator key to move the current tab to the right. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="detach-tab" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Accelerator to detach current tab.</summary>
|
||||||
|
<description>Accelerator key to detach current tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-1" type="s">
|
||||||
|
<default>'<Alt>1'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 1</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 1. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-2" type="s">
|
||||||
|
<default>'<Alt>2'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 2</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 2. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-3" type="s">
|
||||||
|
<default>'<Alt>3'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 3</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 3. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-4" type="s">
|
||||||
|
<default>'<Alt>4'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 4</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 4. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-5" type="s">
|
||||||
|
<default>'<Alt>5'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 5</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 5. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-6" type="s">
|
||||||
|
<default>'<Alt>6'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 6</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 6. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-7" type="s">
|
||||||
|
<default>'<Alt>7'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 7</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 7. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-8" type="s">
|
||||||
|
<default>'<Alt>8'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 8</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 8. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-9" type="s">
|
||||||
|
<default>'<Alt>9'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 9</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 9. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-10" type="s">
|
||||||
|
<default>'<Alt>0'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 10</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 10. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-11" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 11</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 11. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="switch-to-tab-12" type="s">
|
||||||
|
<default>'disabled'</default>
|
||||||
|
<summary>Keyboard shortcut to switch to tab 12</summary>
|
||||||
|
<description>Keyboard shortcut key for switch to tab 12. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="help" type="s">
|
||||||
|
<default>'F1'</default>
|
||||||
|
<summary>Keyboard shortcut to launch help</summary>
|
||||||
|
<description>Keyboard shortcut key for launching help. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="zoom-in" type="s">
|
||||||
|
<default>'<Ctrl>plus'</default>
|
||||||
|
<summary>Keyboard shortcut to make font larger</summary>
|
||||||
|
<description>Keyboard shortcut key for making font larger. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="zoom-out" type="s">
|
||||||
|
<default>'<Ctrl>minus'</default>
|
||||||
|
<summary>Keyboard shortcut to make font smaller</summary>
|
||||||
|
<description>Keyboard shortcut key for making font smaller. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
<key name="zoom-normal" type="s">
|
||||||
|
<default>'<Ctrl>0'</default>
|
||||||
|
<summary>Keyboard shortcut to make font normal-size</summary>
|
||||||
|
<description>Keyboard shortcut key for making font the normal size. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
|
@ -567,7 +567,7 @@ editor_response_cb (GtkWidget *editor,
|
||||||
{
|
{
|
||||||
if (response == GTK_RESPONSE_HELP)
|
if (response == GTK_RESPONSE_HELP)
|
||||||
{
|
{
|
||||||
terminal_util_show_help ("gatuno-terminal-prefs", GTK_WINDOW (editor));
|
terminal_util_show_help ("mate-terminal-prefs", GTK_WINDOW (editor));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="title" translatable="yes">Profiles</property>
|
<property name="title" translatable="yes">Profiles</property>
|
||||||
<property name="role">gatuno-terminal-profile-manager</property>
|
<property name="role">mate-terminal-profile-manager</property>
|
||||||
<property name="default_width">400</property>
|
<property name="default_width">400</property>
|
||||||
<property name="default_height">300</property>
|
<property name="default_height">300</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
|
|
@ -231,7 +231,7 @@ Author: Wolfgang Ulbrich
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="title" translatable="yes">Profile Editor</property>
|
<property name="title" translatable="yes">Profile Editor</property>
|
||||||
<property name="role">gatuno-terminal-profile-editor</property>
|
<property name="role">mate-terminal-profile-editor</property>
|
||||||
<property name="default_width">600</property>
|
<property name="default_width">600</property>
|
||||||
<property name="default_height">400</property>
|
<property name="default_height">400</property>
|
||||||
<property name="destroy_with_parent">True</property>
|
<property name="destroy_with_parent">True</property>
|
||||||
|
|
|
@ -359,7 +359,7 @@ enum
|
||||||
N_COLUMNS
|
N_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void keys_change_notify (GKeyFile *settings,
|
static void keys_change_notify (GSettings *settings,
|
||||||
const gchar *key,
|
const gchar *key,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
@ -373,6 +373,10 @@ static gboolean binding_from_string (const char *str,
|
||||||
guint *accelerator_key,
|
guint *accelerator_key,
|
||||||
GdkModifierType *accelerator_mods);
|
GdkModifierType *accelerator_mods);
|
||||||
|
|
||||||
|
static gboolean binding_from_value (GVariant *value,
|
||||||
|
guint *accelerator_key,
|
||||||
|
GdkModifierType *accelerator_mods);
|
||||||
|
|
||||||
static gboolean sync_idle_cb (gpointer data);
|
static gboolean sync_idle_cb (gpointer data);
|
||||||
|
|
||||||
static guint sync_idle_id = 0;
|
static guint sync_idle_id = 0;
|
||||||
|
@ -382,6 +386,7 @@ static int inside_gsettings_notify = 0;
|
||||||
static GtkWidget *edit_keys_dialog = NULL;
|
static GtkWidget *edit_keys_dialog = NULL;
|
||||||
static GtkTreeStore *edit_keys_store = NULL;
|
static GtkTreeStore *edit_keys_store = NULL;
|
||||||
static GHashTable *gsettings_key_to_entry;
|
static GHashTable *gsettings_key_to_entry;
|
||||||
|
static GSettings *settings_keybindings;
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
binding_name (guint keyval,
|
binding_name (guint keyval,
|
||||||
|
@ -408,6 +413,13 @@ terminal_accels_init (void)
|
||||||
{
|
{
|
||||||
guint i, j;
|
guint i, j;
|
||||||
|
|
||||||
|
settings_keybindings = g_settings_new (CONF_KEYS_SCHEMA);
|
||||||
|
|
||||||
|
g_signal_connect (settings_keybindings,
|
||||||
|
"changed",
|
||||||
|
G_CALLBACK(keys_change_notify),
|
||||||
|
NULL);
|
||||||
|
|
||||||
gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
|
gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
|
||||||
notification_group = gtk_accel_group_new ();
|
notification_group = gtk_accel_group_new ();
|
||||||
|
@ -432,7 +444,7 @@ terminal_accels_init (void)
|
||||||
gtk_accel_group_connect_by_path (notification_group,
|
gtk_accel_group_connect_by_path (notification_group,
|
||||||
I_(key_entry->accel_path),
|
I_(key_entry->accel_path),
|
||||||
key_entry->closure);
|
key_entry->closure);
|
||||||
keys_change_notify (terminal_app_get_global_settings (), key_entry->gsettings_key, NULL);
|
keys_change_notify (settings_keybindings, key_entry->gsettings_key, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,6 +455,12 @@ terminal_accels_init (void)
|
||||||
void
|
void
|
||||||
terminal_accels_shutdown (void)
|
terminal_accels_shutdown (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func (settings_keybindings,
|
||||||
|
G_CALLBACK(keys_change_notify),
|
||||||
|
NULL);
|
||||||
|
g_object_unref (settings_keybindings);
|
||||||
|
|
||||||
if (sync_idle_id != 0)
|
if (sync_idle_id != 0)
|
||||||
{
|
{
|
||||||
g_source_remove (sync_idle_id);
|
g_source_remove (sync_idle_id);
|
||||||
|
@ -479,38 +497,32 @@ update_model_foreach (GtkTreeModel *model,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
keys_change_notify (GKeyFile *settings,
|
keys_change_notify (GSettings *settings,
|
||||||
const gchar *key,
|
const gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gchar *val;
|
GVariant *val;
|
||||||
KeyEntry *key_entry;
|
KeyEntry *key_entry;
|
||||||
GdkModifierType mask;
|
GdkModifierType mask;
|
||||||
guint keyval;
|
guint keyval;
|
||||||
gboolean has_ini_value = TRUE;
|
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
||||||
"key %s changed\n",
|
"key %s changed\n",
|
||||||
key);
|
key);
|
||||||
|
|
||||||
val = g_key_file_get_string (settings, CONF_KEYS_SCHEMA, key, &gerror);
|
val = g_settings_get_value (settings, key);
|
||||||
|
|
||||||
if (gerror != NULL) {
|
|
||||||
g_error_free (gerror);
|
|
||||||
|
|
||||||
has_ini_value = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MATE_ENABLE_DEBUG
|
#ifdef MATE_ENABLE_DEBUG
|
||||||
_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
|
_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
|
||||||
{
|
{
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
|
||||||
|
else if (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
|
||||||
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n");
|
||||||
else
|
else
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
||||||
" changed to \"%s\"\n",
|
" changed to \"%s\"\n",
|
||||||
val);
|
g_variant_get_string (val, NULL));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -520,18 +532,15 @@ keys_change_notify (GKeyFile *settings,
|
||||||
/* shouldn't really happen, but let's be safe */
|
/* shouldn't really happen, but let's be safe */
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
||||||
" WARNING: KeyEntry for changed key not found, bailing out\n");
|
" WARNING: KeyEntry for changed key not found, bailing out\n");
|
||||||
g_free (val);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_ini_value == FALSE) {
|
if (!binding_from_value (val, &keyval, &mask))
|
||||||
keyval = key_entry->gsettings_keyval;
|
{
|
||||||
mask = key_entry->gsettings_mask;
|
const char *str = g_variant_is_of_type (val, G_VARIANT_TYPE_STRING) ? g_variant_get_string (val, NULL) : NULL;
|
||||||
} else if (!binding_from_string (val, &keyval, &mask)) {
|
|
||||||
g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
|
g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
|
||||||
val ? val : "(null)",
|
str ? str : "(null)",
|
||||||
key_entry->gsettings_key);
|
key_entry->gsettings_key);
|
||||||
g_free (val);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
key_entry->gsettings_keyval = keyval;
|
key_entry->gsettings_keyval = keyval;
|
||||||
|
@ -554,7 +563,7 @@ keys_change_notify (GKeyFile *settings,
|
||||||
inside_gsettings_notify -= 1;
|
inside_gsettings_notify -= 1;
|
||||||
|
|
||||||
/* Lock the path if the GSettings key isn't writable */
|
/* Lock the path if the GSettings key isn't writable */
|
||||||
key_entry->accel_path_unlocked = TRUE;
|
key_entry->accel_path_unlocked = g_settings_is_writable (settings, key);
|
||||||
if (!key_entry->accel_path_unlocked)
|
if (!key_entry->accel_path_unlocked)
|
||||||
gtk_accel_map_lock_path (key_entry->accel_path);
|
gtk_accel_map_lock_path (key_entry->accel_path);
|
||||||
|
|
||||||
|
@ -568,7 +577,7 @@ keys_change_notify (GKeyFile *settings,
|
||||||
if (edit_keys_store)
|
if (edit_keys_store)
|
||||||
gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store), update_model_foreach, key_entry);
|
gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store), update_model_foreach, key_entry);
|
||||||
|
|
||||||
g_free (val);
|
g_variant_unref(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -630,10 +639,31 @@ binding_from_string (const char *str,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
binding_from_value (GVariant *value,
|
||||||
|
guint *accelerator_key,
|
||||||
|
GdkModifierType *accelerator_mods)
|
||||||
|
{
|
||||||
|
if (value == NULL)
|
||||||
|
{
|
||||||
|
/* unset */
|
||||||
|
*accelerator_key = 0;
|
||||||
|
*accelerator_mods = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return binding_from_string (g_variant_get_string (value,NULL),
|
||||||
|
accelerator_key,
|
||||||
|
accelerator_mods);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_key_entry_to_changeset (gpointer key,
|
add_key_entry_to_changeset (gpointer key,
|
||||||
KeyEntry *key_entry,
|
KeyEntry *key_entry,
|
||||||
GKeyFile *changeset)
|
GSettings *changeset)
|
||||||
{
|
{
|
||||||
GtkAccelKey gtk_key;
|
GtkAccelKey gtk_key;
|
||||||
|
|
||||||
|
@ -649,8 +679,7 @@ add_key_entry_to_changeset (gpointer key,
|
||||||
char *accel_name;
|
char *accel_name;
|
||||||
|
|
||||||
accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
|
accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
|
||||||
g_key_file_set_string (changeset, CONF_KEYS_SCHEMA, key_entry->gsettings_key, accel_name);
|
g_settings_set_string (changeset, key_entry->gsettings_key, accel_name);
|
||||||
keys_change_notify (changeset, key_entry->gsettings_key, NULL);
|
|
||||||
g_free (accel_name);
|
g_free (accel_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,12 +687,20 @@ add_key_entry_to_changeset (gpointer key,
|
||||||
static gboolean
|
static gboolean
|
||||||
sync_idle_cb (gpointer data)
|
sync_idle_cb (gpointer data)
|
||||||
{
|
{
|
||||||
|
GSettings *changeset;
|
||||||
|
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
|
||||||
"GSettings sync handler\n");
|
"GSettings sync handler\n");
|
||||||
|
|
||||||
sync_idle_id = 0;
|
sync_idle_id = 0;
|
||||||
|
|
||||||
g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, terminal_app_get_global_settings ());
|
changeset = g_settings_new (CONF_KEYS_SCHEMA);
|
||||||
|
g_settings_delay (changeset);
|
||||||
|
|
||||||
|
g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
|
||||||
|
g_settings_apply(changeset);
|
||||||
|
|
||||||
|
g_object_unref (changeset);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -855,10 +892,9 @@ other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gset
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_key_file_set_string (terminal_app_get_global_settings (), CONF_KEYS_SCHEMA,
|
g_settings_set_string (settings_keybindings,
|
||||||
ke->gsettings_key,
|
ke->gsettings_key,
|
||||||
str);
|
str);
|
||||||
keys_change_notify (terminal_app_get_global_settings (), ke->gsettings_key, NULL);
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,10 +938,9 @@ accel_cleared_callback (GtkCellRendererAccel *cell,
|
||||||
"Cleared keybinding for GSettings %s",
|
"Cleared keybinding for GSettings %s",
|
||||||
ke->gsettings_key);
|
ke->gsettings_key);
|
||||||
|
|
||||||
g_key_file_set_string (terminal_app_get_global_settings (), CONF_KEYS_SCHEMA,
|
g_settings_set_string (settings_keybindings,
|
||||||
ke->gsettings_key,
|
ke->gsettings_key,
|
||||||
str);
|
str);
|
||||||
keys_change_notify (terminal_app_get_global_settings (), ke->gsettings_key, NULL);
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +960,7 @@ edit_keys_dialog_response_cb (GtkWidget *editor,
|
||||||
{
|
{
|
||||||
if (response == GTK_RESPONSE_HELP)
|
if (response == GTK_RESPONSE_HELP)
|
||||||
{
|
{
|
||||||
terminal_util_show_help ("gatuno-terminal-shortcuts", GTK_WINDOW (editor));
|
terminal_util_show_help ("mate-terminal-shortcuts", GTK_WINDOW (editor));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <dconf.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
|
|
||||||
#include "terminal-intl.h"
|
#include "terminal-intl.h"
|
||||||
|
|
||||||
|
@ -45,11 +41,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "eggsmclient.h"
|
||||||
|
#include "eggdesktopfile.h"
|
||||||
|
|
||||||
#define FALLBACK_PROFILE_ID "default"
|
#define FALLBACK_PROFILE_ID "default"
|
||||||
|
|
||||||
/* Settings storage works as follows:
|
/* Settings storage works as follows:
|
||||||
* ~/.gatuno-terminal/config
|
* /apps/mate-terminal/global/
|
||||||
* ~/.gatuno-terminal/profiles/Foo
|
* /apps/mate-terminal/profiles/Foo/
|
||||||
*
|
*
|
||||||
* It's somewhat tricky to manage the profiles/ dir since we need to track
|
* It's somewhat tricky to manage the profiles/ dir since we need to track
|
||||||
* the list of profiles, but GSettings doesn't have a concept of notifying that
|
* the list of profiles, but GSettings doesn't have a concept of notifying that
|
||||||
|
@ -91,6 +90,9 @@ struct _TerminalApp
|
||||||
GtkWidget *manage_profiles_delete_button;
|
GtkWidget *manage_profiles_delete_button;
|
||||||
GtkWidget *manage_profiles_default_menu;
|
GtkWidget *manage_profiles_default_menu;
|
||||||
|
|
||||||
|
GSettings *settings_global;
|
||||||
|
GSettings *settings_font;
|
||||||
|
|
||||||
GHashTable *profiles;
|
GHashTable *profiles;
|
||||||
char* default_profile_id;
|
char* default_profile_id;
|
||||||
TerminalProfile *default_profile;
|
TerminalProfile *default_profile;
|
||||||
|
@ -136,7 +138,6 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
static TerminalApp *global_app = NULL;
|
static TerminalApp *global_app = NULL;
|
||||||
static GKeyFile *settings_global = NULL;
|
|
||||||
|
|
||||||
#define MONOSPACE_FONT_SCHEMA "org.mate.interface"
|
#define MONOSPACE_FONT_SCHEMA "org.mate.interface"
|
||||||
#define MONOSPACE_FONT_KEY "monospace-font-name"
|
#define MONOSPACE_FONT_KEY "monospace-font-name"
|
||||||
|
@ -160,10 +161,64 @@ static GKeyFile *settings_global = NULL;
|
||||||
* FIXME: I suspect there's no need for excessive copies, we might use
|
* FIXME: I suspect there's no need for excessive copies, we might use
|
||||||
* existing profile list to form GVariant's and write them to GSettings
|
* existing profile list to form GVariant's and write them to GSettings
|
||||||
*/
|
*/
|
||||||
|
static gboolean
|
||||||
|
gsettings_append_strv (GSettings *settings,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *value)
|
||||||
|
{
|
||||||
|
gchar **old;
|
||||||
|
gchar **new;
|
||||||
|
gint size;
|
||||||
|
gboolean retval;
|
||||||
|
|
||||||
|
old = g_settings_get_strv (settings, key);
|
||||||
|
|
||||||
|
for (size = 0; old[size] != NULL; size++);
|
||||||
|
|
||||||
|
size += 1; /* appended value */
|
||||||
|
size += 1; /* NULL */
|
||||||
|
|
||||||
|
new = g_realloc_n (old, size, sizeof (gchar *));
|
||||||
|
|
||||||
|
new[size - 2] = g_strdup (value);
|
||||||
|
new[size - 1] = NULL;
|
||||||
|
|
||||||
|
retval = g_settings_set_strv (settings, key,
|
||||||
|
(const gchar **) new);
|
||||||
|
|
||||||
|
g_strfreev (new);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gsettings_remove_all_from_strv (GSettings *settings,
|
||||||
|
const gchar *key,
|
||||||
|
const gchar *value)
|
||||||
|
{
|
||||||
|
GArray *array;
|
||||||
|
gchar **old;
|
||||||
|
gint i;
|
||||||
|
gboolean retval;
|
||||||
|
|
||||||
|
old = g_settings_get_strv (settings, key);
|
||||||
|
array = g_array_new (TRUE, TRUE, sizeof (gchar *));
|
||||||
|
|
||||||
|
for (i = 0; old[i] != NULL; i++) {
|
||||||
|
if (g_strcmp0 (old[i], value) != 0)
|
||||||
|
array = g_array_append_val (array, old[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = g_settings_set_strv (settings, key,
|
||||||
|
(const gchar **) array->data);
|
||||||
|
|
||||||
|
g_strfreev (old);
|
||||||
|
g_array_free (array, TRUE);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
static void terminal_app_profile_list_notify_cb (TerminalApp *app);
|
|
||||||
static void terminal_app_default_profile_notify_cb (GKeyFile *settings, gchar *key, gpointer user_data);
|
|
||||||
|
|
||||||
static GdkScreen*
|
static GdkScreen*
|
||||||
terminal_app_get_screen_by_display_name (const char *display_name,
|
terminal_app_get_screen_by_display_name (const char *display_name,
|
||||||
|
@ -328,15 +383,20 @@ terminal_app_delete_profile (TerminalApp *app,
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
|
profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
|
||||||
profile_dir = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", profile_name, NULL);
|
profile_dir = g_strconcat (CONF_PROFILE_PREFIX, profile_name, "/", NULL);
|
||||||
|
|
||||||
/* Borrar el archivo */
|
gsettings_remove_all_from_strv (app->settings_global, PROFILE_LIST_KEY, profile_name);
|
||||||
g_unlink (profile_dir);
|
|
||||||
|
|
||||||
|
/* And remove the profile directory */
|
||||||
|
DConfClient *client = dconf_client_new ();
|
||||||
|
if (!dconf_client_write_sync (client, profile_dir, NULL, NULL, NULL, &error))
|
||||||
|
{
|
||||||
|
g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref (client);
|
||||||
g_free (profile_dir);
|
g_free (profile_dir);
|
||||||
|
|
||||||
/* Volver a listar los perfiles para provocar que se actualicen */
|
|
||||||
terminal_app_profile_list_notify_cb (app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -503,9 +563,8 @@ profile_combo_box_changed_cb (GtkWidget *widget,
|
||||||
if (!profile)
|
if (!profile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_key_file_set_string (settings_global, CONF_GLOBAL_SCHEMA, DEFAULT_PROFILE_KEY, terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME));
|
g_settings_set_string (app->settings_global, DEFAULT_PROFILE_KEY,
|
||||||
terminal_app_default_profile_notify_cb (settings_global, DEFAULT_PROFILE_KEY, app);
|
terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME));
|
||||||
/* FIXME: ¿debería guardar el archivo? */
|
|
||||||
|
|
||||||
/* Even though the GSettings change notification does this, it happens too late.
|
/* Even though the GSettings change notification does this, it happens too late.
|
||||||
* In some cases, the default profile changes twice in quick succession,
|
* In some cases, the default profile changes twice in quick succession,
|
||||||
|
@ -750,45 +809,15 @@ find_profile_link (GList *profiles,
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar **terminal_app_profile_list_from_dir (TerminalApp *app) {
|
|
||||||
GDir *dir;
|
|
||||||
gchar *profile_dir;
|
|
||||||
GPtrArray *builder_str;
|
|
||||||
const gchar *file;
|
|
||||||
char *dup;
|
|
||||||
int ret;
|
|
||||||
gchar **profile_list = NULL;
|
|
||||||
|
|
||||||
profile_dir = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles", NULL);
|
|
||||||
|
|
||||||
/* Posiblemente no exista, intentar crear como directorio */
|
|
||||||
ret = g_mkdir_with_parents (profile_dir, 0755);
|
|
||||||
|
|
||||||
builder_str = g_ptr_array_new_with_free_func (g_free);
|
|
||||||
dir = g_dir_open (profile_dir, 0, NULL);
|
|
||||||
g_free (profile_dir);
|
|
||||||
if (dir != NULL) {
|
|
||||||
while (file = g_dir_read_name (dir), file != NULL) {
|
|
||||||
dup = g_strdup (file);
|
|
||||||
g_ptr_array_add (builder_str, dup);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_ptr_array_add (builder_str, NULL);
|
|
||||||
profile_list = (gchar **) g_ptr_array_free (builder_str, FALSE);
|
|
||||||
|
|
||||||
g_dir_close (dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
//g_ptr_array_unref (builder_str);
|
|
||||||
return profile_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* El listador principal de perfiles */
|
|
||||||
static void
|
static void
|
||||||
terminal_app_profile_list_notify_cb (TerminalApp *app)
|
terminal_app_profile_list_notify_cb (GSettings *settings,
|
||||||
|
gchar *key,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
GObject *object = G_OBJECT (app);
|
GObject *object = G_OBJECT (app);
|
||||||
gchar **value_list;
|
GVariant *val;
|
||||||
|
const gchar **value_list;
|
||||||
int i;
|
int i;
|
||||||
GList *profiles_to_delete, *l;
|
GList *profiles_to_delete, *l;
|
||||||
gboolean need_new_default;
|
gboolean need_new_default;
|
||||||
|
@ -799,8 +828,13 @@ terminal_app_profile_list_notify_cb (TerminalApp *app)
|
||||||
|
|
||||||
profiles_to_delete = terminal_app_get_profile_list (app);
|
profiles_to_delete = terminal_app_get_profile_list (app);
|
||||||
|
|
||||||
value_list = terminal_app_profile_list_from_dir (app);
|
val = g_settings_get_value (settings, key);
|
||||||
|
if (val == NULL ||
|
||||||
|
(!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY) &&
|
||||||
|
!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)))
|
||||||
|
goto ensure_one_profile;
|
||||||
|
|
||||||
|
value_list = g_variant_get_strv (val, NULL);
|
||||||
if (value_list == NULL)
|
if (value_list == NULL)
|
||||||
goto ensure_one_profile;
|
goto ensure_one_profile;
|
||||||
|
|
||||||
|
@ -821,10 +855,13 @@ terminal_app_profile_list_notify_cb (TerminalApp *app)
|
||||||
terminal_app_create_profile (app, profile_name);
|
terminal_app_create_profile (app, profile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (value_list);
|
g_free (value_list);
|
||||||
|
|
||||||
ensure_one_profile:
|
ensure_one_profile:
|
||||||
|
|
||||||
|
if (val != NULL)
|
||||||
|
g_variant_unref (val);
|
||||||
|
|
||||||
fallback = NULL;
|
fallback = NULL;
|
||||||
count = g_hash_table_size (app->profiles);
|
count = g_hash_table_size (app->profiles);
|
||||||
if (count == 0 || count <= g_list_length (profiles_to_delete))
|
if (count == 0 || count <= g_list_length (profiles_to_delete))
|
||||||
|
@ -900,19 +937,22 @@ ensure_one_profile:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_app_default_profile_notify_cb (GKeyFile *settings,
|
terminal_app_default_profile_notify_cb (GSettings *settings,
|
||||||
gchar *key,
|
gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (user_data);
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
GVariant *val;
|
GVariant *val;
|
||||||
char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
app->default_profile_locked = FALSE;
|
app->default_profile_locked = !g_settings_is_writable (settings, key);
|
||||||
|
|
||||||
name = g_key_file_get_string (settings, CONF_GLOBAL_SCHEMA, key, NULL);
|
val = g_settings_get_value (settings, key);
|
||||||
|
if (val != NULL &&
|
||||||
|
g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
|
||||||
|
name = g_variant_get_string (val, NULL);
|
||||||
if (!name || !name[0])
|
if (!name || !name[0])
|
||||||
name = g_strdup (FALLBACK_PROFILE_ID);
|
name = FALLBACK_PROFILE_ID;
|
||||||
g_assert (name != NULL);
|
g_assert (name != NULL);
|
||||||
|
|
||||||
g_free (app->default_profile_id);
|
g_free (app->default_profile_id);
|
||||||
|
@ -921,7 +961,7 @@ terminal_app_default_profile_notify_cb (GKeyFile *settings,
|
||||||
app->default_profile = terminal_app_get_profile_by_name (app, name);
|
app->default_profile = terminal_app_get_profile_by_name (app, name);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
|
g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
|
||||||
g_free (name);
|
g_variant_unref (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -942,18 +982,19 @@ encoding_mark_active (gpointer key,
|
||||||
encoding->is_active = active;
|
encoding->is_active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
terminal_app_encoding_list_notify_cb (GKeyFile *settings,
|
terminal_app_encoding_list_notify_cb (GSettings *settings,
|
||||||
gchar *key,
|
gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (user_data);
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
gchar **strings;
|
GVariant *val;
|
||||||
|
const gchar **strings;
|
||||||
int i;
|
int i;
|
||||||
TerminalEncoding *encoding;
|
TerminalEncoding *encoding;
|
||||||
const char *charset;
|
const char *charset;
|
||||||
|
|
||||||
app->encodings_locked = FALSE;
|
app->encodings_locked = !g_settings_is_writable (settings, key);
|
||||||
|
|
||||||
/* Mark all as non-active, then re-enable the active ones */
|
/* Mark all as non-active, then re-enable the active ones */
|
||||||
g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE));
|
g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE));
|
||||||
|
@ -970,7 +1011,12 @@ terminal_app_encoding_list_notify_cb (GKeyFile *settings,
|
||||||
if (terminal_encoding_is_valid (encoding))
|
if (terminal_encoding_is_valid (encoding))
|
||||||
encoding->is_active = TRUE;
|
encoding->is_active = TRUE;
|
||||||
|
|
||||||
strings = g_key_file_get_string_list (settings, CONF_GLOBAL_SCHEMA, key, NULL, NULL);
|
val = g_settings_get_value (settings, key);
|
||||||
|
if (val != NULL &&
|
||||||
|
g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY))
|
||||||
|
strings = g_variant_get_strv (val, NULL);
|
||||||
|
else
|
||||||
|
strings = NULL;
|
||||||
|
|
||||||
if (strings != NULL)
|
if (strings != NULL)
|
||||||
{
|
{
|
||||||
|
@ -987,18 +1033,40 @@ terminal_app_encoding_list_notify_cb (GKeyFile *settings,
|
||||||
encoding->is_active = TRUE;
|
encoding->is_active = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (strings);
|
g_free (strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
|
g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
|
||||||
|
|
||||||
|
if (val != NULL)
|
||||||
|
g_variant_unref (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_app_system_set_default_font (TerminalApp *app)
|
terminal_app_system_font_notify_cb (GSettings *settings,
|
||||||
|
gchar *key,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
|
GVariant *val;
|
||||||
|
const char *font = NULL;
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
|
|
||||||
font_desc = pango_font_description_from_string (DEFAULT_MONOSPACE_FONT);
|
if (strcmp (key, MONOSPACE_FONT_KEY) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
val = g_settings_get_value (settings, key);
|
||||||
|
if (val &&
|
||||||
|
g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
|
||||||
|
font = g_variant_get_string (val, NULL);
|
||||||
|
if (!font)
|
||||||
|
font = DEFAULT_MONOSPACE_FONT;
|
||||||
|
g_assert (font != NULL);
|
||||||
|
|
||||||
|
if (font && (strlen (font) == 0)) /* empty string */
|
||||||
|
font = DEFAULT_MONOSPACE_FONT;
|
||||||
|
|
||||||
|
font_desc = pango_font_description_from_string (font);
|
||||||
if (app->system_font_desc &&
|
if (app->system_font_desc &&
|
||||||
pango_font_description_equal (app->system_font_desc, font_desc))
|
pango_font_description_equal (app->system_font_desc, font_desc))
|
||||||
{
|
{
|
||||||
|
@ -1012,23 +1080,18 @@ terminal_app_system_set_default_font (TerminalApp *app)
|
||||||
app->system_font_desc = font_desc;
|
app->system_font_desc = font_desc;
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT);
|
g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT);
|
||||||
|
g_variant_unref (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_app_enable_mnemonics_notify_cb (GKeyFile *settings,
|
terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
|
||||||
gchar *key,
|
gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (user_data);
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
gboolean enable;
|
gboolean enable;
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
enable = g_key_file_get_boolean (settings, CONF_GLOBAL_SCHEMA, key, &gerror);
|
enable = g_settings_get_boolean (settings, key);
|
||||||
if (gerror != NULL) {
|
|
||||||
/* Ocurrió un error, no es booleano */
|
|
||||||
g_error_free (gerror);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enable == app->enable_mnemonics)
|
if (enable == app->enable_mnemonics)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1037,20 +1100,14 @@ terminal_app_enable_mnemonics_notify_cb (GKeyFile *settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_app_enable_menu_accels_notify_cb (GKeyFile *settings,
|
terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
|
||||||
gchar *key,
|
gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (user_data);
|
TerminalApp *app = TERMINAL_APP (user_data);
|
||||||
gboolean enable;
|
gboolean enable;
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
enable = g_key_file_get_boolean (settings, CONF_GLOBAL_SCHEMA, key, &gerror);
|
enable = g_settings_get_boolean (settings, key);
|
||||||
if (gerror != NULL) {
|
|
||||||
/* Ocurrió un error, no es booleano */
|
|
||||||
g_error_free (gerror);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enable == app->enable_menu_accels)
|
if (enable == app->enable_menu_accels)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1109,9 +1166,8 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
|
||||||
/* Alternative button order was set automatically by GtkMessageDialog */
|
/* Alternative button order was set automatically by GtkMessageDialog */
|
||||||
retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
|
retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
|
||||||
gtk_widget_destroy (confirm_dialog);
|
gtk_widget_destroy (confirm_dialog);
|
||||||
if (retval == GTK_RESPONSE_NO) {
|
if (retval == GTK_RESPONSE_NO)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_list_free (profiles);
|
g_list_free (profiles);
|
||||||
|
|
||||||
|
@ -1123,8 +1179,13 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
|
||||||
g_strdup (new_profile_name),
|
g_strdup (new_profile_name),
|
||||||
new_profile /* adopts the refcount */);
|
new_profile /* adopts the refcount */);
|
||||||
|
|
||||||
|
/* And now save the new profile name to GSettings */
|
||||||
|
gsettings_append_strv (app->settings_global,
|
||||||
|
PROFILE_LIST_KEY,
|
||||||
|
new_profile_name);
|
||||||
|
|
||||||
terminal_profile_edit (new_profile, transient_parent, NULL);
|
terminal_profile_edit (new_profile, transient_parent, NULL);
|
||||||
terminal_app_profile_list_notify_cb (app);
|
|
||||||
cleanup:
|
cleanup:
|
||||||
g_free (name);
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
@ -1233,7 +1294,7 @@ profile_list_response_cb (GtkWidget *dialog,
|
||||||
|
|
||||||
if (id == GTK_RESPONSE_HELP)
|
if (id == GTK_RESPONSE_HELP)
|
||||||
{
|
{
|
||||||
terminal_util_show_help ("gatuno-terminal-manage-profiles", GTK_WINDOW (dialog));
|
terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,6 +1393,21 @@ terminal_app_manage_profiles (TerminalApp *app,
|
||||||
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
|
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
terminal_app_save_state_cb (EggSMClient *client,
|
||||||
|
GKeyFile *key_file,
|
||||||
|
TerminalApp *app)
|
||||||
|
{
|
||||||
|
terminal_app_save_config (app, key_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
terminal_app_client_quit_cb (EggSMClient *client,
|
||||||
|
TerminalApp *app)
|
||||||
|
{
|
||||||
|
g_signal_emit (app, signals[QUIT], 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Class implementation */
|
/* Class implementation */
|
||||||
|
|
||||||
G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
|
||||||
|
@ -1339,7 +1415,6 @@ G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
|
||||||
static void
|
static void
|
||||||
terminal_app_init (TerminalApp *app)
|
terminal_app_init (TerminalApp *app)
|
||||||
{
|
{
|
||||||
gchar *concat;
|
|
||||||
global_app = app;
|
global_app = app;
|
||||||
|
|
||||||
gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME);
|
gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME);
|
||||||
|
@ -1347,36 +1422,62 @@ terminal_app_init (TerminalApp *app)
|
||||||
/* Initialise defaults */
|
/* Initialise defaults */
|
||||||
app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS;
|
app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS;
|
||||||
app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL;
|
app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL;
|
||||||
app->system_font_desc = NULL;
|
|
||||||
app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
||||||
|
|
||||||
app->encodings = terminal_encodings_get_builtins ();
|
app->encodings = terminal_encodings_get_builtins ();
|
||||||
|
|
||||||
/* Verificar que exista como directorio */
|
app->settings_global = g_settings_new (CONF_GLOBAL_SCHEMA);
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal", NULL);
|
app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA);
|
||||||
/* Posiblemente no exista, intentar crear como directorio */
|
|
||||||
g_mkdir_with_parents (concat, 0755);
|
|
||||||
g_free (concat);
|
|
||||||
|
|
||||||
settings_global = g_key_file_new ();
|
g_signal_connect (app->settings_global,
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/config", NULL);
|
"changed::" PROFILE_LIST_KEY,
|
||||||
g_key_file_load_from_file (settings_global, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
|
G_CALLBACK(terminal_app_profile_list_notify_cb),
|
||||||
g_free (concat);
|
app);
|
||||||
|
|
||||||
|
g_signal_connect (app->settings_global,
|
||||||
|
"changed::" DEFAULT_PROFILE_KEY,
|
||||||
|
G_CALLBACK(terminal_app_default_profile_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
|
g_signal_connect (app->settings_global,
|
||||||
|
"changed::" ENCODING_LIST_KEY,
|
||||||
|
G_CALLBACK(terminal_app_encoding_list_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
|
g_signal_connect (app->settings_font,
|
||||||
|
"changed::" MONOSPACE_FONT_KEY,
|
||||||
|
G_CALLBACK(terminal_app_system_font_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
|
|
||||||
|
g_signal_connect (app->settings_global,
|
||||||
|
"changed::" ENABLE_MNEMONICS_KEY,
|
||||||
|
G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
|
g_signal_connect (app->settings_global,
|
||||||
|
"changed::" ENABLE_MENU_BAR_ACCEL_KEY,
|
||||||
|
G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
/* Load the settings */
|
/* Load the settings */
|
||||||
terminal_app_profile_list_notify_cb (app);
|
terminal_app_profile_list_notify_cb (app->settings_global,
|
||||||
|
PROFILE_LIST_KEY,
|
||||||
terminal_app_default_profile_notify_cb (settings_global,
|
app);
|
||||||
|
terminal_app_default_profile_notify_cb (app->settings_global,
|
||||||
DEFAULT_PROFILE_KEY,
|
DEFAULT_PROFILE_KEY,
|
||||||
app);
|
app);
|
||||||
terminal_app_encoding_list_notify_cb (settings_global,
|
terminal_app_encoding_list_notify_cb (app->settings_global,
|
||||||
ENCODING_LIST_KEY,
|
ENCODING_LIST_KEY,
|
||||||
app);
|
app);
|
||||||
terminal_app_system_set_default_font (app);
|
terminal_app_system_font_notify_cb (app->settings_font,
|
||||||
terminal_app_enable_menu_accels_notify_cb (settings_global,
|
MONOSPACE_FONT_KEY,
|
||||||
|
app);
|
||||||
|
terminal_app_enable_menu_accels_notify_cb (app->settings_global,
|
||||||
ENABLE_MENU_BAR_ACCEL_KEY,
|
ENABLE_MENU_BAR_ACCEL_KEY,
|
||||||
app);
|
app);
|
||||||
terminal_app_enable_mnemonics_notify_cb (settings_global,
|
terminal_app_enable_mnemonics_notify_cb (app->settings_global,
|
||||||
ENABLE_MNEMONICS_KEY,
|
ENABLE_MNEMONICS_KEY,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
|
@ -1385,19 +1486,56 @@ terminal_app_init (TerminalApp *app)
|
||||||
g_assert (app->system_font_desc != NULL);
|
g_assert (app->system_font_desc != NULL);
|
||||||
|
|
||||||
terminal_accels_init ();
|
terminal_accels_init ();
|
||||||
|
|
||||||
|
EggSMClient *sm_client;
|
||||||
|
char *desktop_file;
|
||||||
|
|
||||||
|
desktop_file = g_build_filename (TERM_DATADIR,
|
||||||
|
"applications",
|
||||||
|
PACKAGE ".desktop",
|
||||||
|
NULL);
|
||||||
|
egg_set_desktop_file_without_defaults (desktop_file);
|
||||||
|
g_free (desktop_file);
|
||||||
|
|
||||||
|
sm_client = egg_sm_client_get ();
|
||||||
|
g_signal_connect (sm_client, "save-state",
|
||||||
|
G_CALLBACK (terminal_app_save_state_cb), app);
|
||||||
|
g_signal_connect (sm_client, "quit",
|
||||||
|
G_CALLBACK (terminal_app_client_quit_cb), app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_app_finalize (GObject *object)
|
terminal_app_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
TerminalApp *app = TERMINAL_APP (object);
|
TerminalApp *app = TERMINAL_APP (object);
|
||||||
gchar *concat;
|
|
||||||
|
|
||||||
/* Guardar las configuraciones antes de salir */
|
EggSMClient *sm_client;
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/config", NULL);
|
|
||||||
g_key_file_save_to_file (settings_global, concat, NULL);
|
sm_client = egg_sm_client_get ();
|
||||||
g_key_file_free (settings_global);
|
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
|
||||||
g_free (concat);
|
0, 0, NULL, NULL, app);
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_global,
|
||||||
|
G_CALLBACK(terminal_app_profile_list_notify_cb),
|
||||||
|
app);
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_global,
|
||||||
|
G_CALLBACK(terminal_app_default_profile_notify_cb),
|
||||||
|
app);
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_global,
|
||||||
|
G_CALLBACK(terminal_app_encoding_list_notify_cb),
|
||||||
|
app);
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_font,
|
||||||
|
G_CALLBACK(terminal_app_system_font_notify_cb),
|
||||||
|
app);
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_global,
|
||||||
|
G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
|
||||||
|
app);
|
||||||
|
g_signal_handlers_disconnect_by_func (app->settings_global,
|
||||||
|
G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
|
||||||
|
app);
|
||||||
|
|
||||||
|
g_object_unref (app->settings_global);
|
||||||
|
g_object_unref (app->settings_font);
|
||||||
|
|
||||||
g_free (app->default_profile_id);
|
g_free (app->default_profile_id);
|
||||||
|
|
||||||
|
@ -1457,11 +1595,11 @@ terminal_app_set_property (GObject *object,
|
||||||
{
|
{
|
||||||
case PROP_ENABLE_MENU_BAR_ACCEL:
|
case PROP_ENABLE_MENU_BAR_ACCEL:
|
||||||
app->enable_menu_accels = g_value_get_boolean (value);
|
app->enable_menu_accels = g_value_get_boolean (value);
|
||||||
g_key_file_set_boolean (settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels);
|
g_settings_set_boolean (app->settings_global, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels);
|
||||||
break;
|
break;
|
||||||
case PROP_ENABLE_MNEMONICS:
|
case PROP_ENABLE_MNEMONICS:
|
||||||
app->enable_mnemonics = g_value_get_boolean (value);
|
app->enable_mnemonics = g_value_get_boolean (value);
|
||||||
g_key_file_set_boolean (settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MNEMONICS_KEY, app->enable_mnemonics);
|
g_settings_set_boolean (app->settings_global, ENABLE_MNEMONICS_KEY, app->enable_mnemonics);
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_PROFILE:
|
case PROP_DEFAULT_PROFILE:
|
||||||
case PROP_SYSTEM_FONT:
|
case PROP_SYSTEM_FONT:
|
||||||
|
@ -1559,10 +1697,6 @@ terminal_app_get (void)
|
||||||
return global_app;
|
return global_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
GKeyFile *terminal_app_get_global_settings (void) {
|
|
||||||
return settings_global;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
terminal_app_shutdown (void)
|
terminal_app_shutdown (void)
|
||||||
{
|
{
|
||||||
|
@ -1625,6 +1759,20 @@ terminal_app_handle_options (TerminalApp *app,
|
||||||
/* fall-through on success */
|
/* fall-through on success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EggSMClient *sm_client;
|
||||||
|
|
||||||
|
sm_client = egg_sm_client_get ();
|
||||||
|
|
||||||
|
if (allow_resume && egg_sm_client_is_resumed (sm_client))
|
||||||
|
{
|
||||||
|
GKeyFile *key_file;
|
||||||
|
|
||||||
|
key_file = egg_sm_client_get_state_file (sm_client);
|
||||||
|
if (key_file != NULL &&
|
||||||
|
!terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure we open at least one window */
|
/* Make sure we open at least one window */
|
||||||
terminal_options_ensure_window (options);
|
terminal_options_ensure_window (options);
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,12 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
|
|
||||||
#define CONF_GLOBAL_SCHEMA "global"
|
#define CONF_PREFIX "org.mate.terminal"
|
||||||
#define CONF_KEYS_SCHEMA "keybindings"
|
#define CONF_GLOBAL_SCHEMA CONF_PREFIX ".global"
|
||||||
|
#define CONF_PROFILES_SCHEMA CONF_PREFIX ".profiles"
|
||||||
|
#define CONF_PROFILE_SCHEMA CONF_PREFIX ".profile"
|
||||||
|
#define CONF_KEYS_SCHEMA CONF_PREFIX ".keybindings"
|
||||||
|
#define CONF_PROFILE_PREFIX "/org/mate/terminal/profiles/"
|
||||||
|
|
||||||
#define MATE_TERMINAL_ICON_NAME "utilities-terminal"
|
#define MATE_TERMINAL_ICON_NAME "utilities-terminal"
|
||||||
|
|
||||||
|
@ -82,7 +86,6 @@ typedef struct _TerminalApp TerminalApp;
|
||||||
GType terminal_app_get_type (void);
|
GType terminal_app_get_type (void);
|
||||||
|
|
||||||
TerminalApp* terminal_app_get (void);
|
TerminalApp* terminal_app_get (void);
|
||||||
GKeyFile *terminal_app_get_global_settings (void);
|
|
||||||
|
|
||||||
void terminal_app_shutdown (void);
|
void terminal_app_shutdown (void);
|
||||||
|
|
||||||
|
@ -155,10 +158,6 @@ gboolean terminal_app_save_config_file (TerminalApp *app,
|
||||||
const char *file_name,
|
const char *file_name,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void
|
|
||||||
terminal_app_encoding_list_notify_cb (GKeyFile *settings,
|
|
||||||
gchar *key,
|
|
||||||
gpointer user_data);
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* !TERMINAL_APP_H */
|
#endif /* !TERMINAL_APP_H */
|
||||||
|
|
|
@ -290,7 +290,7 @@ update_active_encodings_gsettings (void)
|
||||||
GSList *list, *l;
|
GSList *list, *l;
|
||||||
GArray *strings;
|
GArray *strings;
|
||||||
const gchar *id_string;
|
const gchar *id_string;
|
||||||
GKeyFile *settings;
|
GSettings *settings;
|
||||||
|
|
||||||
list = terminal_app_get_active_encodings (terminal_app_get ());
|
list = terminal_app_get_active_encodings (terminal_app_get ());
|
||||||
strings = g_array_new (TRUE, TRUE, sizeof (gchar *));
|
strings = g_array_new (TRUE, TRUE, sizeof (gchar *));
|
||||||
|
@ -302,14 +302,13 @@ update_active_encodings_gsettings (void)
|
||||||
strings = g_array_append_val (strings, id_string);
|
strings = g_array_append_val (strings, id_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings = terminal_app_get_global_settings ();
|
settings = g_settings_new (CONF_GLOBAL_SCHEMA);
|
||||||
g_key_file_set_string_list (settings, CONF_GLOBAL_SCHEMA, "active-encodings", (const gchar **) strings->data, g_strv_length ((const gchar **) strings->data));
|
g_settings_set_strv (settings, "active-encodings", (const gchar **) strings->data);
|
||||||
|
g_object_unref (settings);
|
||||||
|
|
||||||
g_array_free (strings, TRUE);
|
g_array_free (strings, TRUE);
|
||||||
g_slist_foreach (list, (GFunc) terminal_encoding_unref, NULL);
|
g_slist_foreach (list, (GFunc) terminal_encoding_unref, NULL);
|
||||||
g_slist_free (list);
|
g_slist_free (list);
|
||||||
|
|
||||||
terminal_app_encoding_list_notify_cb (settings, "active-encodings", terminal_app_get ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -318,7 +317,7 @@ response_callback (GtkWidget *window,
|
||||||
EncodingDialogData *data)
|
EncodingDialogData *data)
|
||||||
{
|
{
|
||||||
if (id == GTK_RESPONSE_HELP)
|
if (id == GTK_RESPONSE_HELP)
|
||||||
terminal_util_show_help ("gatuno-terminal-encoding-add", GTK_WINDOW (window));
|
terminal_util_show_help ("mate-terminal-encoding-add", GTK_WINDOW (window));
|
||||||
else
|
else
|
||||||
gtk_widget_destroy (GTK_WIDGET (window));
|
gtk_widget_destroy (GTK_WIDGET (window));
|
||||||
}
|
}
|
||||||
|
@ -490,7 +489,7 @@ terminal_encoding_dialog_show (GtkWindow *transient_parent)
|
||||||
g_object_set_data_full (G_OBJECT (data->dialog), "GT::Data", data, (GDestroyNotify) encoding_dialog_data_free);
|
g_object_set_data_full (G_OBJECT (data->dialog), "GT::Data", data, (GDestroyNotify) encoding_dialog_data_free);
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (data->dialog), transient_parent);
|
gtk_window_set_transient_for (GTK_WINDOW (data->dialog), transient_parent);
|
||||||
gtk_window_set_role (GTK_WINDOW (data->dialog), "gatuno-terminal-encodings");
|
gtk_window_set_role (GTK_WINDOW (data->dialog), "mate-terminal-encodings");
|
||||||
g_signal_connect (data->dialog, "response",
|
g_signal_connect (data->dialog, "response",
|
||||||
G_CALLBACK (response_callback), data);
|
G_CALLBACK (response_callback), data);
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ unsupported_option_callback (const gchar *option_name,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_printerr (_("Option \"%s\" is no longer supported in this version of gatuno-terminal;"
|
g_printerr (_("Option \"%s\" is no longer supported in this version of mate-terminal;"
|
||||||
" you might want to create a profile with the desired setting, and use"
|
" you might want to create a profile with the desired setting, and use"
|
||||||
" the new '--profile' option\n"), option_name);
|
" the new '--profile' option\n"), option_name);
|
||||||
return TRUE; /* we do not want to bail out here but continue */
|
return TRUE; /* we do not want to bail out here but continue */
|
||||||
|
@ -186,7 +186,7 @@ option_version_cb (const gchar *option_name,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_print ("%s %s\n", _("Gatuno Terminal"), VERSION);
|
g_print ("%s %s\n", _("MATE Terminal"), VERSION);
|
||||||
|
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -1363,11 +1363,11 @@ get_goption_context (TerminalOptions *options)
|
||||||
|
|
||||||
context = g_option_context_new (NULL);
|
context = g_option_context_new (NULL);
|
||||||
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
|
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
|
||||||
g_option_context_set_description (context, N_("Gatuno Terminal Emulator"));
|
g_option_context_set_description (context, N_("MATE Terminal Emulator"));
|
||||||
|
|
||||||
group = g_option_group_new ("gatuno-terminal",
|
group = g_option_group_new ("mate-terminal",
|
||||||
N_("Gatuno Terminal Emulator"),
|
N_("MATE Terminal Emulator"),
|
||||||
N_("Show Gatuno Terminal options"),
|
N_("Show MATE Terminal options"),
|
||||||
options,
|
options,
|
||||||
NULL);
|
NULL);
|
||||||
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
|
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
|
||||||
|
|
|
@ -165,15 +165,15 @@ enum
|
||||||
#define DEFAULT_VISIBLE_NAME (N_("Unnamed"))
|
#define DEFAULT_VISIBLE_NAME (N_("Unnamed"))
|
||||||
#define DEFAULT_WORD_CHARS ("-A-Za-z0-9,./?%&#:_=+@~")
|
#define DEFAULT_WORD_CHARS ("-A-Za-z0-9,./?%&#:_=+@~")
|
||||||
|
|
||||||
#define PROFILE_GROUP_NAME "profile"
|
|
||||||
|
|
||||||
struct _TerminalProfilePrivate
|
struct _TerminalProfilePrivate
|
||||||
{
|
{
|
||||||
GValueArray *properties;
|
GValueArray *properties;
|
||||||
|
gboolean *locked;
|
||||||
|
|
||||||
GKeyFile *settings;
|
GSettings *settings;
|
||||||
char *profile_dir;
|
char *profile_dir;
|
||||||
|
|
||||||
|
GSList *dirty_pspecs;
|
||||||
guint save_idle_id;
|
guint save_idle_id;
|
||||||
|
|
||||||
GParamSpec *gsettings_notification_pspec;
|
GParamSpec *gsettings_notification_pspec;
|
||||||
|
@ -547,139 +547,95 @@ terminal_profile_reset_property_internal (TerminalProfile *profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_profile_ini_read (GKeyFile *settings,
|
terminal_profile_gsettings_notify_cb (GSettings *settings,
|
||||||
gchar *key,
|
gchar *key,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TerminalProfile *profile = TERMINAL_PROFILE (user_data);
|
TerminalProfile *profile = TERMINAL_PROFILE (user_data);
|
||||||
TerminalProfilePrivate *priv = profile->priv;
|
TerminalProfilePrivate *priv = profile->priv;
|
||||||
TerminalProfileClass *klass;
|
TerminalProfileClass *klass;
|
||||||
GError *gerror = NULL;
|
GVariant *settings_value;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
GValue value = { 0, }, *default_value;
|
GValue value = { 0, };
|
||||||
gboolean equal;
|
gboolean equal;
|
||||||
gboolean force_set = FALSE;
|
gboolean force_set = FALSE;
|
||||||
|
|
||||||
if (!key) return;
|
if (!key) return;
|
||||||
|
|
||||||
|
_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
|
||||||
|
"GSettings notification for key %s [%s]\n",
|
||||||
|
key,
|
||||||
|
g_settings_is_writable (settings, key) ? "writable" : "LOCKED");
|
||||||
|
|
||||||
klass = TERMINAL_PROFILE_GET_CLASS (profile);
|
klass = TERMINAL_PROFILE_GET_CLASS (profile);
|
||||||
pspec = g_hash_table_lookup (klass->gsettings_keys, key);
|
pspec = g_hash_table_lookup (klass->gsettings_keys, key);
|
||||||
if (!pspec)
|
if (!pspec)
|
||||||
return; /* ignore unknown keys, for future extensibility */
|
return; /* ignore unknown keys, for future extensibility */
|
||||||
|
|
||||||
|
priv->locked[pspec->param_id] = !g_settings_is_writable (settings, key);
|
||||||
|
|
||||||
|
settings_value = g_settings_get_value (settings, key);
|
||||||
|
if (!settings_value)
|
||||||
|
return;
|
||||||
|
|
||||||
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||||
|
|
||||||
if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
|
if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
|
||||||
{
|
{
|
||||||
gboolean res;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_BOOLEAN))
|
||||||
res = g_key_file_get_boolean (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), &gerror);
|
goto out;
|
||||||
if (gerror != NULL) {
|
|
||||||
/* No es un boolean, triste caso */
|
|
||||||
g_error_free (gerror);
|
|
||||||
|
|
||||||
default_value = g_param_spec_get_default_value (pspec);
|
g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
|
||||||
res = g_value_get_boolean (default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_set_boolean (&value, res);
|
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_STRING (pspec))
|
else if (G_IS_PARAM_SPEC_STRING (pspec))
|
||||||
{
|
{
|
||||||
gchar *cadena;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
|
||||||
cadena = g_key_file_get_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL);
|
|
||||||
|
|
||||||
if (cadena == NULL) {
|
|
||||||
default_value = g_param_spec_get_default_value (pspec);
|
|
||||||
g_value_set_string (&value, g_value_get_string (default_value));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
g_value_set_string (&value, cadena);
|
g_value_set_string (&value, g_variant_get_string (settings_value, NULL));
|
||||||
g_free (cadena);
|
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_ENUM (pspec))
|
else if (G_IS_PARAM_SPEC_ENUM (pspec))
|
||||||
{
|
{
|
||||||
gint entero;
|
|
||||||
entero = g_key_file_get_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), &gerror);
|
|
||||||
if (gerror != NULL) {
|
|
||||||
/* No es un entero, mal */
|
|
||||||
g_error_free (gerror);
|
|
||||||
default_value = g_param_spec_get_default_value (pspec);
|
|
||||||
entero = g_value_get_enum (default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_set_enum (&value, entero);
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
g_value_set_enum (&value, g_settings_get_enum (settings, key));
|
||||||
}
|
}
|
||||||
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
||||||
{
|
{
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
|
||||||
gchar *cadena;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
|
||||||
cadena = g_key_file_get_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL);
|
goto out;
|
||||||
|
|
||||||
if (cadena == NULL) {
|
if (!gdk_rgba_parse (&color, g_variant_get_string (settings_value, NULL)))
|
||||||
if (strcmp (g_param_spec_get_name (pspec), KEY_FOREGROUND_COLOR) == 0) {
|
|
||||||
cadena = g_strdup ("#000000");
|
|
||||||
} else if (strcmp (g_param_spec_get_name (pspec), KEY_BACKGROUND_COLOR) == 0) {
|
|
||||||
cadena = g_strdup ("#FFFFDD");
|
|
||||||
} else if (strcmp (g_param_spec_get_name (pspec), KEY_BOLD_COLOR) == 0) {
|
|
||||||
cadena = g_strdup ("#000000");
|
|
||||||
} else {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gdk_rgba_parse (&color, cadena)) {
|
|
||||||
g_free (cadena);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
g_free (cadena);
|
|
||||||
|
|
||||||
g_value_set_boxed (&value, &color);
|
g_value_set_boxed (&value, &color);
|
||||||
}
|
}
|
||||||
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
|
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
|
||||||
{
|
{
|
||||||
gchar *cadena;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
|
||||||
cadena = g_key_file_get_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL);
|
goto out;
|
||||||
|
|
||||||
if (cadena == NULL) {
|
g_value_take_boxed (&value, pango_font_description_from_string (g_variant_get_string (settings_value, NULL)));
|
||||||
if (strcmp (g_param_spec_get_name (pspec), KEY_FONT) == 0) {
|
|
||||||
cadena = g_strdup ("Monospace 12");
|
|
||||||
} else {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_take_boxed (&value, pango_font_description_from_string (cadena));
|
|
||||||
g_free (cadena);
|
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
|
else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
|
||||||
{
|
{
|
||||||
gdouble doble;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_DOUBLE))
|
||||||
doble = g_key_file_get_double (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), &gerror);
|
goto out;
|
||||||
|
|
||||||
if (gerror != NULL) {
|
g_value_set_double (&value, g_variant_get_double (settings_value));
|
||||||
g_error_free (gerror);
|
|
||||||
default_value = g_param_spec_get_default_value (pspec);
|
|
||||||
doble = g_value_get_double (default_value);
|
|
||||||
}
|
|
||||||
g_value_set_double (&value, doble);
|
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_INT (pspec))
|
else if (G_IS_PARAM_SPEC_INT (pspec))
|
||||||
{
|
{
|
||||||
gint entero;
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT16) &&
|
||||||
entero = g_key_file_get_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), &gerror);
|
!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT32) &&
|
||||||
|
!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_INT64))
|
||||||
|
goto out;
|
||||||
|
|
||||||
if (gerror != NULL) {
|
g_value_set_int (&value, g_settings_get_int(settings, key));
|
||||||
/* No es un entero, mal */
|
|
||||||
g_error_free (gerror);
|
|
||||||
|
|
||||||
default_value = g_param_spec_get_default_value (pspec);
|
|
||||||
entero = g_value_get_int (default_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_value_set_int (&value, entero);
|
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
|
else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
|
||||||
G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
|
G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
|
||||||
|
@ -688,10 +644,12 @@ terminal_profile_ini_read (GKeyFile *settings,
|
||||||
GdkRGBA *colors;
|
GdkRGBA *colors;
|
||||||
int n_colors, i;
|
int n_colors, i;
|
||||||
|
|
||||||
color_strings = g_key_file_get_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL, NULL);
|
if (!g_variant_is_of_type (settings_value, G_VARIANT_TYPE_STRING))
|
||||||
if (color_strings == NULL) {
|
goto out;
|
||||||
color_strings = g_strsplit ("#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC", ":", 0);
|
|
||||||
}
|
color_strings = g_strsplit (g_variant_get_string (settings_value, NULL), ":", -1);
|
||||||
|
if (!color_strings)
|
||||||
|
goto out;
|
||||||
|
|
||||||
n_colors = g_strv_length (color_strings);
|
n_colors = g_strv_length (color_strings);
|
||||||
colors = g_new0 (GdkRGBA, n_colors);
|
colors = g_new0 (GdkRGBA, n_colors);
|
||||||
|
@ -755,33 +713,53 @@ out:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
g_variant_unref (settings_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParamSpec *pspec) {
|
terminal_profile_gsettings_changeset_add (TerminalProfile *profile,
|
||||||
|
GSettings *changeset,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
TerminalProfilePrivate *priv = profile->priv;
|
TerminalProfilePrivate *priv = profile->priv;
|
||||||
TerminalProfileClass *klass;
|
char *key;
|
||||||
GValue *value;
|
const GValue *value;
|
||||||
|
|
||||||
if (settings == NULL) return;
|
/* FIXME: do this? */
|
||||||
|
#if 0
|
||||||
|
if (priv->locked[pspec->param_id])
|
||||||
|
return;
|
||||||
|
|
||||||
klass = TERMINAL_PROFILE_GET_CLASS (profile);
|
if (!g_settings_is_writable (priv->settings, gsettings_key, NULL))
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
key = g_param_spec_get_qdata (pspec, gsettings_key_quark);
|
||||||
|
if (!key)
|
||||||
|
return;
|
||||||
|
|
||||||
value = g_value_array_get_nth (priv->properties, pspec->param_id);
|
value = g_value_array_get_nth (priv->properties, pspec->param_id);
|
||||||
|
|
||||||
|
_terminal_debug_print (TERMINAL_DEBUG_PROFILE,
|
||||||
|
"Adding pspec %s with value %s to the GSettings changeset\n",
|
||||||
|
pspec->name, g_strdup_value_contents (value));
|
||||||
|
|
||||||
if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
|
if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
|
||||||
{
|
g_settings_set_boolean (changeset, key, g_value_get_boolean (value));
|
||||||
g_key_file_set_boolean (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_boolean (value));
|
|
||||||
}
|
|
||||||
else if (G_IS_PARAM_SPEC_STRING (pspec))
|
else if (G_IS_PARAM_SPEC_STRING (pspec))
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
str = g_value_get_string (value);
|
str = g_value_get_string (value);
|
||||||
g_key_file_set_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), str ? str : "");
|
g_settings_set_string (changeset, key, str ? str : "");
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_ENUM (pspec))
|
else if (G_IS_PARAM_SPEC_ENUM (pspec))
|
||||||
{
|
{
|
||||||
g_key_file_set_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_enum (value));
|
const GEnumValue *eval;
|
||||||
|
|
||||||
|
eval = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, g_value_get_enum (value));
|
||||||
|
|
||||||
|
g_settings_set_enum (changeset, key, eval->value);
|
||||||
}
|
}
|
||||||
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
||||||
{
|
{
|
||||||
|
@ -793,11 +771,12 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
g_snprintf (str, sizeof (str),
|
g_snprintf (str, sizeof (str),
|
||||||
"#%04X%04X%04X",
|
"#%04X%04X%04X",
|
||||||
(guint) (color->red * 65535),
|
(guint) (color->red * 65535),
|
||||||
(guint) (color->green * 65535),
|
(guint) (color->green * 65535),
|
||||||
(guint) (color->blue * 65535));
|
(guint) (color->blue * 65535));
|
||||||
g_key_file_set_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), str);
|
|
||||||
|
g_settings_set_string (changeset, key, str);
|
||||||
}
|
}
|
||||||
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
|
else if (G_PARAM_SPEC_VALUE_TYPE (pspec) == PANGO_TYPE_FONT_DESCRIPTION)
|
||||||
{
|
{
|
||||||
|
@ -809,60 +788,54 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
font = pango_font_description_to_string (font_desc);
|
font = pango_font_description_to_string (font_desc);
|
||||||
g_key_file_set_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), font);
|
g_settings_set_string (changeset, key, font);
|
||||||
g_free (font);
|
g_free (font);
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
|
else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
|
||||||
{
|
g_settings_set_double (changeset, key, g_value_get_double (value));
|
||||||
g_key_file_set_double (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_double (value));
|
|
||||||
}
|
|
||||||
else if (G_IS_PARAM_SPEC_INT (pspec))
|
else if (G_IS_PARAM_SPEC_INT (pspec))
|
||||||
{
|
g_settings_set_int (changeset, key, g_value_get_int (value));
|
||||||
g_key_file_set_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_int (value));
|
|
||||||
}
|
|
||||||
else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
|
else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
|
||||||
G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
|
G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
|
||||||
{
|
{
|
||||||
GValueArray *array;
|
GValueArray *array;
|
||||||
GPtrArray *builder_str;
|
GString *string;
|
||||||
char **color_strings;
|
guint n_colors, i;
|
||||||
GdkRGBA color;
|
|
||||||
int n_colors, i;
|
|
||||||
gchar *cadena;
|
|
||||||
|
|
||||||
array = (GValueArray *) g_value_get_boxed (value);
|
/* We need to do this ourselves, because the gtk_color_selection_palette_to_string
|
||||||
|
* does not carry all the bytes, and xterm's palette is messed up...
|
||||||
|
*/
|
||||||
|
|
||||||
builder_str = g_ptr_array_new_with_free_func (g_free);
|
array = g_value_get_boxed (value);
|
||||||
|
if (!array)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
n_colors = array->n_values;
|
n_colors = array->n_values;
|
||||||
|
string = g_string_sized_new (n_colors * (1 /* # */ + 3 * 4) + n_colors /* : separators and terminating \0 */);
|
||||||
for (i = 0; i < n_colors; ++i)
|
for (i = 0; i < n_colors; ++i)
|
||||||
{
|
{
|
||||||
GdkRGBA *color;
|
GdkRGBA *color;
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
g_string_append_c (string, ':');
|
||||||
|
|
||||||
color = g_value_get_boxed (g_value_array_get_nth (array, i));
|
color = g_value_get_boxed (g_value_array_get_nth (array, i));
|
||||||
if (!color) {
|
if (!color)
|
||||||
g_ptr_array_add (builder_str, g_strdup (""));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
cadena = g_strdup_printf ("#%04X%04X%04X",
|
g_string_append_printf (string,
|
||||||
(guint) (color->red * 65535),
|
"#%04X%04X%04X",
|
||||||
(guint) (color->green * 65535),
|
(guint) (color->red * 65535),
|
||||||
(guint) (color->blue * 65535));
|
(guint) (color->green * 65535),
|
||||||
|
(guint) (color->blue * 65535));
|
||||||
g_ptr_array_add (builder_str, cadena);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ptr_array_add (builder_str, NULL);
|
g_settings_set_string (changeset, key, string->str);
|
||||||
color_strings = (gchar **) g_ptr_array_free (builder_str, FALSE);
|
g_string_free (string, TRUE);
|
||||||
g_key_file_set_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), color_strings, n_colors);
|
|
||||||
g_strfreev (color_strings);
|
|
||||||
g_ptr_array_unref (builder_str);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), pspec->name);
|
g_printerr ("Unhandled value type %s of pspec %s\n", g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), pspec->name);
|
||||||
}
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -871,15 +844,18 @@ static void
|
||||||
terminal_profile_save (TerminalProfile *profile)
|
terminal_profile_save (TerminalProfile *profile)
|
||||||
{
|
{
|
||||||
TerminalProfilePrivate *priv = profile->priv;
|
TerminalProfilePrivate *priv = profile->priv;
|
||||||
|
GSettings *changeset;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
gchar *concat;
|
gchar *concat;
|
||||||
GError *gerror = NULL;
|
|
||||||
gboolean was_saved;
|
|
||||||
|
|
||||||
priv->save_idle_id = 0;
|
priv->save_idle_id = 0;
|
||||||
|
concat = g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir,"/", NULL);
|
||||||
|
changeset = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
|
||||||
|
g_free (concat);
|
||||||
|
g_settings_delay (changeset);
|
||||||
|
|
||||||
#if 0
|
for (l = priv->dirty_pspecs; l != NULL; l = l->next)
|
||||||
for (l = priv->dirty_pspecs; l != NULL; l = l->next) {
|
{
|
||||||
GParamSpec *pspec = (GParamSpec *) l->data;
|
GParamSpec *pspec = (GParamSpec *) l->data;
|
||||||
|
|
||||||
if (pspec->owner_type != TERMINAL_TYPE_PROFILE)
|
if (pspec->owner_type != TERMINAL_TYPE_PROFILE)
|
||||||
|
@ -888,22 +864,14 @@ terminal_profile_save (TerminalProfile *profile)
|
||||||
if ((pspec->flags & G_PARAM_WRITABLE) == 0)
|
if ((pspec->flags & G_PARAM_WRITABLE) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
terminal_profile_ini_write (profile, priv->settings, pspec);
|
terminal_profile_gsettings_changeset_add (profile, changeset, pspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free (priv->dirty_pspecs);
|
g_slist_free (priv->dirty_pspecs);
|
||||||
priv->dirty_pspecs = NULL;
|
priv->dirty_pspecs = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL);
|
g_settings_apply (changeset);
|
||||||
|
g_object_unref (changeset);
|
||||||
was_saved = g_key_file_save_to_file (priv->settings, concat, &gerror);
|
|
||||||
|
|
||||||
if (gerror != NULL) {
|
|
||||||
g_error_free (gerror);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (concat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -923,9 +891,8 @@ terminal_profile_schedule_save (TerminalProfile *profile,
|
||||||
|
|
||||||
g_assert (pspec != NULL);
|
g_assert (pspec != NULL);
|
||||||
|
|
||||||
if (pspec->owner_type == TERMINAL_TYPE_PROFILE && (pspec->flags & G_PARAM_WRITABLE) != 0) {
|
if (!g_slist_find (priv->dirty_pspecs, pspec))
|
||||||
terminal_profile_ini_write (profile, priv->settings, pspec);
|
priv->dirty_pspecs = g_slist_prepend (priv->dirty_pspecs, pspec);
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->save_idle_id != 0)
|
if (priv->save_idle_id != 0)
|
||||||
return;
|
return;
|
||||||
|
@ -944,6 +911,7 @@ terminal_profile_init (TerminalProfile *profile)
|
||||||
priv = profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile, TERMINAL_TYPE_PROFILE, TerminalProfilePrivate);
|
priv = profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile, TERMINAL_TYPE_PROFILE, TerminalProfilePrivate);
|
||||||
|
|
||||||
priv->gsettings_notification_pspec = NULL;
|
priv->gsettings_notification_pspec = NULL;
|
||||||
|
priv->locked = g_new0 (gboolean, LAST_PROP);
|
||||||
|
|
||||||
priv->properties = g_value_array_new (LAST_PROP);
|
priv->properties = g_value_array_new (LAST_PROP);
|
||||||
for (i = 0; i < LAST_PROP; ++i)
|
for (i = 0; i < LAST_PROP; ++i)
|
||||||
|
@ -997,9 +965,16 @@ terminal_profile_constructor (GType type,
|
||||||
name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
|
name = g_value_get_string (g_value_array_get_nth (priv->properties, PROP_NAME));
|
||||||
g_assert (name != NULL);
|
g_assert (name != NULL);
|
||||||
|
|
||||||
priv->settings = g_key_file_new ();
|
concat = g_strconcat (CONF_PROFILE_PREFIX, name, "/", NULL);
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL);
|
priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
|
||||||
g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
|
g_assert (priv->settings != NULL);
|
||||||
|
g_free (concat);
|
||||||
|
concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
|
||||||
|
g_signal_connect (priv->settings,
|
||||||
|
concat,
|
||||||
|
G_CALLBACK(terminal_profile_gsettings_notify_cb),
|
||||||
|
profile);
|
||||||
|
|
||||||
g_free (concat);
|
g_free (concat);
|
||||||
|
|
||||||
/* Now load those properties from GSettings that were not set as construction params */
|
/* Now load those properties from GSettings that were not set as construction params */
|
||||||
|
@ -1032,8 +1007,7 @@ terminal_profile_constructor (GType type,
|
||||||
if (!key)
|
if (!key)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Tomar esta propiedad desde el archivo */
|
terminal_profile_gsettings_notify_cb (priv->settings, key, profile);
|
||||||
terminal_profile_ini_read (priv->settings, key, profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (pspecs);
|
g_free (pspecs);
|
||||||
|
@ -1047,6 +1021,10 @@ terminal_profile_finalize (GObject *object)
|
||||||
TerminalProfile *profile = TERMINAL_PROFILE (object);
|
TerminalProfile *profile = TERMINAL_PROFILE (object);
|
||||||
TerminalProfilePrivate *priv = profile->priv;
|
TerminalProfilePrivate *priv = profile->priv;
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func (priv->settings,
|
||||||
|
G_CALLBACK(terminal_profile_gsettings_notify_cb),
|
||||||
|
profile);
|
||||||
|
|
||||||
if (priv->save_idle_id)
|
if (priv->save_idle_id)
|
||||||
{
|
{
|
||||||
g_source_remove (priv->save_idle_id);
|
g_source_remove (priv->save_idle_id);
|
||||||
|
@ -1057,8 +1035,10 @@ terminal_profile_finalize (GObject *object)
|
||||||
|
|
||||||
_terminal_profile_forget (profile);
|
_terminal_profile_forget (profile);
|
||||||
|
|
||||||
g_key_file_free (priv->settings);
|
g_object_unref (priv->settings);
|
||||||
|
|
||||||
g_free (priv->profile_dir);
|
g_free (priv->profile_dir);
|
||||||
|
g_free (priv->locked);
|
||||||
g_value_array_free (priv->properties);
|
g_value_array_free (priv->properties);
|
||||||
|
|
||||||
G_OBJECT_CLASS (terminal_profile_parent_class)->finalize (object);
|
G_OBJECT_CLASS (terminal_profile_parent_class)->finalize (object);
|
||||||
|
@ -1143,18 +1123,23 @@ terminal_profile_set_property (GObject *object,
|
||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
{
|
{
|
||||||
const char *name = g_value_get_string (value);
|
const char *name = g_value_get_string (value);
|
||||||
/* TODO: Cuando un profile cambia de nombre, "vigilar" el nuevo archivo */
|
|
||||||
|
|
||||||
g_assert (name != NULL);
|
g_assert (name != NULL);
|
||||||
priv->profile_dir = g_strdup (name);
|
priv->profile_dir = g_strdup (name);
|
||||||
|
|
||||||
if (priv->settings != NULL) {
|
if (priv->settings != NULL) {
|
||||||
gchar *concat;
|
gchar *concat;
|
||||||
g_key_file_free (priv->settings);
|
g_signal_handlers_disconnect_by_func (priv->settings,
|
||||||
|
G_CALLBACK(terminal_profile_gsettings_notify_cb),
|
||||||
concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL);
|
profile);
|
||||||
priv->settings = g_key_file_new ();
|
g_object_unref (priv->settings);
|
||||||
g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
|
concat= g_strconcat (CONF_PROFILE_PREFIX, priv->profile_dir, "/", NULL);
|
||||||
|
priv->settings = g_settings_new_with_path (CONF_PROFILE_SCHEMA, concat);
|
||||||
|
g_free (concat);
|
||||||
|
concat = g_strconcat("changed::", priv->profile_dir, "/", NULL);
|
||||||
|
g_signal_connect (priv->settings,
|
||||||
|
concat,
|
||||||
|
G_CALLBACK(terminal_profile_gsettings_notify_cb),
|
||||||
|
profile);
|
||||||
g_free (concat);
|
g_free (concat);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1441,6 +1426,8 @@ _terminal_profile_clone (TerminalProfile *base_profile,
|
||||||
/* Flush the new profile to GSettings */
|
/* Flush the new profile to GSettings */
|
||||||
new_priv = new_profile->priv;
|
new_priv = new_profile->priv;
|
||||||
|
|
||||||
|
g_slist_free (new_priv->dirty_pspecs);
|
||||||
|
new_priv->dirty_pspecs = NULL;
|
||||||
if (new_priv->save_idle_id != 0)
|
if (new_priv->save_idle_id != 0)
|
||||||
{
|
{
|
||||||
g_source_remove (new_priv->save_idle_id);
|
g_source_remove (new_priv->save_idle_id);
|
||||||
|
@ -1455,7 +1442,7 @@ _terminal_profile_clone (TerminalProfile *base_profile,
|
||||||
(pspec->flags & G_PARAM_WRITABLE) == 0)
|
(pspec->flags & G_PARAM_WRITABLE) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
terminal_profile_ini_write (new_profile, new_priv->settings, pspec);
|
new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
|
||||||
}
|
}
|
||||||
g_free (pspecs);
|
g_free (pspecs);
|
||||||
|
|
||||||
|
@ -1564,8 +1551,19 @@ terminal_profile_get_property_string (TerminalProfile *profile,
|
||||||
return g_value_get_string (value);
|
return g_value_get_string (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean terminal_profile_property_locked (TerminalProfile *profile, const char *prop_name) {
|
gboolean
|
||||||
return FALSE;
|
terminal_profile_property_locked (TerminalProfile *profile,
|
||||||
|
const char *prop_name)
|
||||||
|
{
|
||||||
|
TerminalProfilePrivate *priv = profile->priv;
|
||||||
|
GParamSpec *pspec;
|
||||||
|
|
||||||
|
pspec = get_pspec_from_name (profile, prop_name);
|
||||||
|
g_return_val_if_fail (pspec != NULL, FALSE);
|
||||||
|
if (!pspec)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return priv->locked[pspec->param_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -470,12 +470,11 @@ terminal_util_key_file_get_argv (GKeyFile *key_file,
|
||||||
/* Proxy stuff */
|
/* Proxy stuff */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
gsettings_get_string (GKeyFile *settings,
|
gsettings_get_string (GSettings *settings,
|
||||||
const char *group,
|
|
||||||
const char *key)
|
const char *key)
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
value = g_key_file_get_string (settings, group, key, NULL);
|
value = g_settings_get_string (settings, key);
|
||||||
if (G_UNLIKELY (value && *value == '\0'))
|
if (G_UNLIKELY (value && *value == '\0'))
|
||||||
{
|
{
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
@ -534,27 +533,27 @@ set_proxy_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_http_proxy_env (GHashTable *env_table,
|
setup_http_proxy_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings_http)
|
||||||
{
|
{
|
||||||
gchar *host;
|
gchar *host;
|
||||||
gint port;
|
gint port;
|
||||||
|
|
||||||
host = gsettings_get_string (settings_global, CONF_HTTP_PROXY_SCHEMA, "host");
|
host = gsettings_get_string (settings_http, "host");
|
||||||
port = g_key_file_get_integer (settings_global, CONF_HTTP_PROXY_SCHEMA, "port", NULL);
|
port = g_settings_get_int (settings_http, "port");
|
||||||
if (host && port)
|
if (host && port)
|
||||||
{
|
{
|
||||||
|
|
||||||
GString *buf = g_string_sized_new (64);
|
GString *buf = g_string_sized_new (64);
|
||||||
g_string_append (buf, "http://");
|
g_string_append (buf, "http://");
|
||||||
|
|
||||||
if (g_key_file_get_boolean (settings_global, CONF_HTTP_PROXY_SCHEMA, "use-authentication", NULL))
|
if (g_settings_get_boolean (settings_http, "use-authentication"))
|
||||||
{
|
{
|
||||||
char *user, *password;
|
char *user, *password;
|
||||||
user = gsettings_get_string (settings_global, CONF_HTTP_PROXY_SCHEMA, "authentication-user");
|
user = gsettings_get_string (settings_http, "authentication-user");
|
||||||
if (user)
|
if (user)
|
||||||
{
|
{
|
||||||
g_string_append_uri_escaped (buf, user, NULL, TRUE);
|
g_string_append_uri_escaped (buf, user, NULL, TRUE);
|
||||||
password = gsettings_get_string (settings_global, CONF_HTTP_PROXY_SCHEMA, "authentication-password");
|
password = gsettings_get_string (settings_http, "authentication-password");
|
||||||
if (password)
|
if (password)
|
||||||
{
|
{
|
||||||
g_string_append_c (buf, ':');
|
g_string_append_c (buf, ':');
|
||||||
|
@ -574,9 +573,9 @@ setup_http_proxy_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_ignore_host_env (GHashTable *env_table,
|
setup_ignore_host_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings)
|
||||||
{
|
{
|
||||||
gchar **ignore = g_key_file_get_string_list (settings_global, CONF_PROXY_SCHEMA, "ignore-hosts", NULL, NULL);
|
gchar **ignore = g_settings_get_strv (settings, "ignore-hosts");
|
||||||
if (ignore == NULL)
|
if (ignore == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -597,13 +596,13 @@ setup_ignore_host_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_https_proxy_env (GHashTable *env_table,
|
setup_https_proxy_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings_https)
|
||||||
{
|
{
|
||||||
gchar *host;
|
gchar *host;
|
||||||
gint port;
|
gint port;
|
||||||
|
|
||||||
host = gsettings_get_string (settings_global, CONF_HTTPS_PROXY_SCHEMA, "host");
|
host = gsettings_get_string (settings_https, "host");
|
||||||
port = g_key_file_get_integer (settings_global, CONF_HTTPS_PROXY_SCHEMA, "port", NULL);
|
port = g_settings_get_int (settings_https, "port");
|
||||||
if (host && port)
|
if (host && port)
|
||||||
{
|
{
|
||||||
char *proxy;
|
char *proxy;
|
||||||
|
@ -616,13 +615,13 @@ setup_https_proxy_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_ftp_proxy_env (GHashTable *env_table,
|
setup_ftp_proxy_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings_ftp)
|
||||||
{
|
{
|
||||||
gchar *host;
|
gchar *host;
|
||||||
gint port;
|
gint port;
|
||||||
|
|
||||||
host = gsettings_get_string (settings_global, CONF_FTP_PROXY_SCHEMA, "host");
|
host = gsettings_get_string (settings_ftp, "host");
|
||||||
port = g_key_file_get_integer (settings_global, CONF_FTP_PROXY_SCHEMA, "port", NULL);
|
port = g_settings_get_int (settings_ftp, "port");
|
||||||
if (host && port)
|
if (host && port)
|
||||||
{
|
{
|
||||||
char *proxy;
|
char *proxy;
|
||||||
|
@ -635,13 +634,13 @@ setup_ftp_proxy_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_socks_proxy_env (GHashTable *env_table,
|
setup_socks_proxy_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings_socks)
|
||||||
{
|
{
|
||||||
gchar *host;
|
gchar *host;
|
||||||
gint port;
|
gint port;
|
||||||
|
|
||||||
host = gsettings_get_string (settings_global, CONF_SOCKS_PROXY_SCHEMA, "host");
|
host = gsettings_get_string (settings_socks, "host");
|
||||||
port = g_key_file_get_integer (settings_global, CONF_SOCKS_PROXY_SCHEMA, "port", NULL);
|
port = g_settings_get_int (settings_socks, "port");
|
||||||
if (host && port)
|
if (host && port)
|
||||||
{
|
{
|
||||||
char *proxy;
|
char *proxy;
|
||||||
|
@ -653,7 +652,7 @@ setup_socks_proxy_env (GHashTable *env_table,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_autoconfig_proxy_env (GHashTable *env_table,
|
setup_autoconfig_proxy_env (GHashTable *env_table,
|
||||||
GKeyFile *settings_global)
|
GSettings *settings)
|
||||||
{
|
{
|
||||||
/* XXX Not sure what to do with this. See bug #596688.
|
/* XXX Not sure what to do with this. See bug #596688.
|
||||||
gchar *url;
|
gchar *url;
|
||||||
|
@ -679,38 +678,33 @@ void
|
||||||
terminal_util_add_proxy_env (GHashTable *env_table)
|
terminal_util_add_proxy_env (GHashTable *env_table)
|
||||||
{
|
{
|
||||||
char *proxymode;
|
char *proxymode;
|
||||||
/* Trasladar estos gsettings al único fichero global */
|
|
||||||
GKeyFile *settings_global = terminal_app_get_global_settings ();
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: Sería ideal trasladar estas configuraciones a un archivo global
|
|
||||||
GSettings *settings = g_settings_new (CONF_PROXY_SCHEMA);
|
GSettings *settings = g_settings_new (CONF_PROXY_SCHEMA);
|
||||||
GSettings *settings_http = g_settings_new (CONF_HTTP_PROXY_SCHEMA);
|
GSettings *settings_http = g_settings_new (CONF_HTTP_PROXY_SCHEMA);
|
||||||
GSettings *settings_https = g_settings_new (CONF_HTTPS_PROXY_SCHEMA);
|
GSettings *settings_https = g_settings_new (CONF_HTTPS_PROXY_SCHEMA);
|
||||||
GSettings *settings_ftp = g_settings_new (CONF_FTP_PROXY_SCHEMA);
|
GSettings *settings_ftp = g_settings_new (CONF_FTP_PROXY_SCHEMA);
|
||||||
GSettings *settings_socks = g_settings_new (CONF_SOCKS_PROXY_SCHEMA);
|
GSettings *settings_socks = g_settings_new (CONF_SOCKS_PROXY_SCHEMA);
|
||||||
*/
|
|
||||||
/* If mode is not manual, nothing to set */
|
/* If mode is not manual, nothing to set */
|
||||||
proxymode = g_key_file_get_string (settings_global, CONF_PROXY_SCHEMA, "mode", NULL);
|
proxymode = gsettings_get_string (settings, "mode");
|
||||||
if (proxymode && 0 == strcmp (proxymode, "manual"))
|
if (proxymode && 0 == strcmp (proxymode, "manual"))
|
||||||
{
|
{
|
||||||
setup_http_proxy_env (env_table, settings_global);
|
setup_http_proxy_env (env_table, settings_http);
|
||||||
setup_ignore_host_env (env_table, settings_global);
|
setup_ignore_host_env (env_table, settings);
|
||||||
setup_https_proxy_env (env_table, settings_global);
|
setup_https_proxy_env (env_table, settings_https);
|
||||||
setup_ftp_proxy_env (env_table, settings_global);
|
setup_ftp_proxy_env (env_table, settings_ftp);
|
||||||
setup_socks_proxy_env (env_table, settings_global);
|
setup_socks_proxy_env (env_table, settings_socks);
|
||||||
}
|
}
|
||||||
else if (proxymode && 0 == strcmp (proxymode, "auto"))
|
else if (proxymode && 0 == strcmp (proxymode, "auto"))
|
||||||
{
|
{
|
||||||
setup_autoconfig_proxy_env (env_table, settings_global);
|
setup_autoconfig_proxy_env (env_table, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (proxymode);
|
g_free (proxymode);
|
||||||
/*g_object_unref (settings);
|
g_object_unref (settings);
|
||||||
g_object_unref (settings_http);
|
g_object_unref (settings_http);
|
||||||
g_object_unref (settings_https);
|
g_object_unref (settings_https);
|
||||||
g_object_unref (settings_ftp);
|
g_object_unref (settings_ftp);
|
||||||
g_object_unref (settings_socks);*/
|
g_object_unref (settings_socks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bidirectional object/widget binding */
|
/* Bidirectional object/widget binding */
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CONF_PROXY_SCHEMA "proxy"
|
#define CONF_PROXY_SCHEMA "org.gnome.system.proxy"
|
||||||
#define CONF_HTTP_PROXY_SCHEMA "proxy.http"
|
#define CONF_HTTP_PROXY_SCHEMA "org.gnome.system.proxy.http"
|
||||||
#define CONF_HTTPS_PROXY_SCHEMA "proxy.https"
|
#define CONF_HTTPS_PROXY_SCHEMA "org.gnome.system.proxy.https"
|
||||||
#define CONF_FTP_PROXY_SCHEMA "proxy.ftp"
|
#define CONF_FTP_PROXY_SCHEMA "org.gnome.system.proxy.ftp"
|
||||||
#define CONF_SOCKS_PROXY_SCHEMA "proxy.socks"
|
#define CONF_SOCKS_PROXY_SCHEMA "org.gnome.system.proxy.socks"
|
||||||
|
|
||||||
void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
|
void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
|
||||||
|
|
||||||
|
|
|
@ -159,10 +159,10 @@ static gboolean terminal_window_focus_in_event (GtkWidget *widget,
|
||||||
|
|
||||||
static gboolean notebook_button_press_cb (GtkWidget *notebook,
|
static gboolean notebook_button_press_cb (GtkWidget *notebook,
|
||||||
GdkEventButton *event,
|
GdkEventButton *event,
|
||||||
gpointer data);
|
GSettings *settings);
|
||||||
static gboolean window_key_press_cb (GtkWidget *notebook,
|
static gboolean window_key_press_cb (GtkWidget *notebook,
|
||||||
GdkEventKey *event,
|
GdkEventKey *event,
|
||||||
gpointer data);
|
GSettings *settings);
|
||||||
static gboolean notebook_popup_menu_cb (GtkWidget *notebook,
|
static gboolean notebook_popup_menu_cb (GtkWidget *notebook,
|
||||||
TerminalWindow *window);
|
TerminalWindow *window);
|
||||||
static void notebook_page_selected_callback (GtkWidget *notebook,
|
static void notebook_page_selected_callback (GtkWidget *notebook,
|
||||||
|
@ -2145,8 +2145,10 @@ terminal_window_init (TerminalWindow *window)
|
||||||
|
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
|
GSettings *settings = g_settings_new ("org.mate.terminal.global");
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
||||||
gtk_style_context_add_class (context, "gatuno-terminal");
|
gtk_style_context_add_class (context, "mate-terminal");
|
||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (window), _("Terminal"));
|
gtk_window_set_title (GTK_WINDOW (window), _("Terminal"));
|
||||||
|
|
||||||
|
@ -2161,11 +2163,11 @@ terminal_window_init (TerminalWindow *window)
|
||||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
|
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
|
||||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||||
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("gatuno-terminal-window"));
|
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
|
||||||
g_signal_connect (priv->notebook, "button-press-event",
|
g_signal_connect (priv->notebook, "button-press-event",
|
||||||
G_CALLBACK (notebook_button_press_cb), NULL);
|
G_CALLBACK (notebook_button_press_cb), settings);
|
||||||
g_signal_connect (window, "key-press-event",
|
g_signal_connect (window, "key-press-event",
|
||||||
G_CALLBACK (window_key_press_cb), NULL);
|
G_CALLBACK (window_key_press_cb), settings);
|
||||||
g_signal_connect (priv->notebook, "popup-menu",
|
g_signal_connect (priv->notebook, "popup-menu",
|
||||||
G_CALLBACK (notebook_popup_menu_cb), window);
|
G_CALLBACK (notebook_popup_menu_cb), window);
|
||||||
g_signal_connect_after (priv->notebook, "switch-page",
|
g_signal_connect_after (priv->notebook, "switch-page",
|
||||||
|
@ -2271,7 +2273,7 @@ terminal_window_init (TerminalWindow *window)
|
||||||
gtk_window_group_add_window (window_group, GTK_WINDOW (window));
|
gtk_window_group_add_window (window_group, GTK_WINDOW (window));
|
||||||
g_object_unref (window_group);
|
g_object_unref (window_group);
|
||||||
|
|
||||||
terminal_util_set_unique_role (GTK_WINDOW (window), "gatuno-terminal-window");
|
terminal_util_set_unique_role (GTK_WINDOW (window), "mate-terminal-window");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2862,7 +2864,7 @@ terminal_window_get_active (TerminalWindow *window)
|
||||||
static gboolean
|
static gboolean
|
||||||
notebook_button_press_cb (GtkWidget *widget,
|
notebook_button_press_cb (GtkWidget *widget,
|
||||||
GdkEventButton *event,
|
GdkEventButton *event,
|
||||||
gpointer data)
|
GSettings *settings)
|
||||||
{
|
{
|
||||||
TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget));
|
TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget));
|
||||||
TerminalWindowPrivate *priv = window->priv;
|
TerminalWindowPrivate *priv = window->priv;
|
||||||
|
@ -2874,17 +2876,9 @@ notebook_button_press_cb (GtkWidget *widget,
|
||||||
int page_num;
|
int page_num;
|
||||||
int before_pages;
|
int before_pages;
|
||||||
int later_pages;
|
int later_pages;
|
||||||
gboolean middle_closes;
|
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
middle_closes = g_key_file_get_boolean (terminal_app_get_global_settings (), CONF_GLOBAL_SCHEMA, "middle-click-closes-tabs", &gerror);
|
if ((event->type == GDK_BUTTON_PRESS && event->button == 2) &&
|
||||||
if (gerror != NULL) {
|
(g_settings_get_boolean (settings, "middle-click-closes-tabs")))
|
||||||
g_error_free (gerror);
|
|
||||||
|
|
||||||
middle_closes = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((event->type == GDK_BUTTON_PRESS && event->button == 2) && middle_closes)
|
|
||||||
{
|
{
|
||||||
tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root);
|
tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root);
|
||||||
if (tab_clicked >= 0)
|
if (tab_clicked >= 0)
|
||||||
|
@ -2942,19 +2936,9 @@ notebook_button_press_cb (GtkWidget *widget,
|
||||||
static gboolean
|
static gboolean
|
||||||
window_key_press_cb (GtkWidget *widget,
|
window_key_press_cb (GtkWidget *widget,
|
||||||
GdkEventKey *event,
|
GdkEventKey *event,
|
||||||
gpointer data)
|
GSettings *settings)
|
||||||
{
|
{
|
||||||
gboolean tab_switches;
|
if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs") &&
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
tab_switches = g_key_file_get_boolean (terminal_app_get_global_settings (), CONF_GLOBAL_SCHEMA, "ctrl-tab-switch-tabs", &gerror);
|
|
||||||
if (gerror != NULL) {
|
|
||||||
g_error_free (gerror);
|
|
||||||
|
|
||||||
tab_switches = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tab_switches &&
|
|
||||||
event->state & GDK_CONTROL_MASK)
|
event->state & GDK_CONTROL_MASK)
|
||||||
{
|
{
|
||||||
TerminalWindow *window = TERMINAL_WINDOW (widget);
|
TerminalWindow *window = TERMINAL_WINDOW (widget);
|
||||||
|
@ -3515,11 +3499,11 @@ confirm_close_window_or_tab (TerminalWindow *window,
|
||||||
{
|
{
|
||||||
TerminalWindowPrivate *priv = window->priv;
|
TerminalWindowPrivate *priv = window->priv;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
GSettings *settings;
|
||||||
gboolean do_confirm;
|
gboolean do_confirm;
|
||||||
gboolean has_processes;
|
gboolean has_processes;
|
||||||
int n_tabs;
|
int n_tabs;
|
||||||
char *confirm_msg;
|
char *confirm_msg;
|
||||||
GError *gerror = NULL;
|
|
||||||
|
|
||||||
if (priv->confirm_close_dialog)
|
if (priv->confirm_close_dialog)
|
||||||
{
|
{
|
||||||
|
@ -3528,13 +3512,9 @@ confirm_close_window_or_tab (TerminalWindow *window,
|
||||||
GTK_RESPONSE_DELETE_EVENT);
|
GTK_RESPONSE_DELETE_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_confirm = g_key_file_get_boolean (terminal_app_get_global_settings (), CONF_GLOBAL_SCHEMA, "confirm-window-close", &gerror);
|
settings = g_settings_new (CONF_GLOBAL_SCHEMA);
|
||||||
if (gerror != NULL) {
|
do_confirm = g_settings_get_boolean (settings, "confirm-window-close");
|
||||||
g_error_free (gerror);
|
g_object_unref (settings);
|
||||||
|
|
||||||
do_confirm = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!do_confirm)
|
if (!do_confirm)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -4188,7 +4168,7 @@ terminal_set_title_callback (GtkAction *action,
|
||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Set Title"));
|
gtk_window_set_title (GTK_WINDOW (dialog), _("Set Title"));
|
||||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||||
gtk_window_set_role (GTK_WINDOW (dialog), "gatuno-terminal-change-title");
|
gtk_window_set_role (GTK_WINDOW (dialog), "mate-terminal-change-title");
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||||
/* Alternative button order was set automatically by GtkMessageDialog */
|
/* Alternative button order was set automatically by GtkMessageDialog */
|
||||||
|
|
||||||
|
@ -4356,8 +4336,7 @@ help_about_callback (GtkAction *action,
|
||||||
"Copyright © 2006 Guilherme de S. Pastore\n"
|
"Copyright © 2006 Guilherme de S. Pastore\n"
|
||||||
"Copyright © 2007–2010 Christian Persch\n"
|
"Copyright © 2007–2010 Christian Persch\n"
|
||||||
"Copyright © 2011 Perberos\n"
|
"Copyright © 2011 Perberos\n"
|
||||||
"Copyright © 2012-2019 MATE developers\n"
|
"Copyright © 2012-2019 MATE developers";
|
||||||
"Copyright © 2021 Gatuno\n";
|
|
||||||
char *licence_text;
|
char *licence_text;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
const guint8 *data;
|
const guint8 *data;
|
||||||
|
@ -4411,9 +4390,9 @@ help_about_callback (GtkAction *action,
|
||||||
licence_text = terminal_util_get_licence_text ();
|
licence_text = terminal_util_get_licence_text ();
|
||||||
|
|
||||||
gtk_show_about_dialog (GTK_WINDOW (window),
|
gtk_show_about_dialog (GTK_WINDOW (window),
|
||||||
"program-name", _("Gatuno Terminal"),
|
"program-name", _("MATE Terminal"),
|
||||||
"copyright", copyright,
|
"copyright", copyright,
|
||||||
"comments", _("A terminal emulator for the desktop"),
|
"comments", _("A terminal emulator for the MATE desktop"),
|
||||||
"version", VERSION,
|
"version", VERSION,
|
||||||
"authors", array_strv,
|
"authors", array_strv,
|
||||||
"artists", artists,
|
"artists", artists,
|
||||||
|
@ -4422,7 +4401,7 @@ help_about_callback (GtkAction *action,
|
||||||
"wrap-license", TRUE,
|
"wrap-license", TRUE,
|
||||||
"translator-credits", _("translator-credits"),
|
"translator-credits", _("translator-credits"),
|
||||||
"logo-icon-name", MATE_TERMINAL_ICON_NAME,
|
"logo-icon-name", MATE_TERMINAL_ICON_NAME,
|
||||||
"website", "http://git.gatuno.mx/gatuno/gatuno-terminal",
|
"website", "http://www.mate-desktop.org",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_strfreev (array_strv);
|
g_strfreev (array_strv);
|
||||||
|
|
455
src/terminal.c
455
src/terminal.c
|
@ -26,7 +26,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
@ -35,10 +34,7 @@
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include "eggsmclient.h"
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
#include <semaphore.h>
|
|
||||||
|
|
||||||
#include "terminal-accels.h"
|
#include "terminal-accels.h"
|
||||||
#include "terminal-app.h"
|
#include "terminal-app.h"
|
||||||
|
@ -47,12 +43,9 @@
|
||||||
#include "terminal-options.h"
|
#include "terminal-options.h"
|
||||||
#include "terminal-util.h"
|
#include "terminal-util.h"
|
||||||
|
|
||||||
#define TERMINAL_FACTORY_UNIX_FOLDER "gatuno-terminal"
|
#define TERMINAL_FACTORY_SERVICE_NAME_PREFIX "org.mate.Terminal.Display"
|
||||||
#define TERMINAL_FACTORY_SERVICE_NAME_PREFIX "factory"
|
#define TERMINAL_FACTORY_SERVICE_PATH "/org/mate/Terminal/Factory"
|
||||||
|
#define TERMINAL_FACTORY_INTERFACE_NAME "org.mate.Terminal.Factory"
|
||||||
int factory_fd_lock = -1;
|
|
||||||
int factory_unix_fd = -1;
|
|
||||||
guint factory_unix_watch = 0;
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
ay_to_string (GVariant *variant,
|
ay_to_string (GVariant *variant,
|
||||||
|
@ -139,101 +132,181 @@ typedef struct
|
||||||
int argc;
|
int argc;
|
||||||
} OwnData;
|
} OwnData;
|
||||||
|
|
||||||
gboolean unix_socket_dgram_recv (GIOChannel *source, GIOCondition condition, gpointer data) {
|
static void
|
||||||
char *message = NULL, byte;
|
method_call_cb (GDBusConnection *connection,
|
||||||
int message_len;
|
const char *sender,
|
||||||
int s;
|
const char *object_path,
|
||||||
|
const char *interface_name,
|
||||||
|
const char *method_name,
|
||||||
|
GVariant *parameters,
|
||||||
|
GDBusMethodInvocation *invocation,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (method_name, "HandleArguments") == 0)
|
||||||
|
{
|
||||||
|
TerminalOptions *options = NULL;
|
||||||
|
GVariant *v_wd, *v_display, *v_sid, *v_envv, *v_argv;
|
||||||
|
char *working_directory = NULL, *display_name = NULL, *startup_id = NULL;
|
||||||
|
int initial_workspace = -1;
|
||||||
|
char **envv = NULL, **argv = NULL;
|
||||||
|
int argc;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
TerminalOptions *options = NULL;
|
g_variant_get (parameters, "(@ay@ay@ay@ayi@ay)",
|
||||||
GVariant *v_wd, *v_display, *v_sid, *v_envv, *v_argv;
|
&v_wd, &v_display, &v_sid, &v_envv, &initial_workspace, &v_argv);
|
||||||
char *working_directory = NULL, *display_name = NULL, *startup_id = NULL;
|
|
||||||
int initial_workspace = -1;
|
|
||||||
char **envv = NULL, **argv = NULL;
|
|
||||||
int argc;
|
|
||||||
GError *error = NULL;
|
|
||||||
GVariant *parameters;
|
|
||||||
|
|
||||||
s = g_io_channel_unix_get_fd (source);
|
working_directory = ay_to_string (v_wd, &error);
|
||||||
|
if (error)
|
||||||
|
goto out;
|
||||||
|
display_name = ay_to_string (v_display, &error);
|
||||||
|
if (error)
|
||||||
|
goto out;
|
||||||
|
startup_id = ay_to_string (v_sid, &error);
|
||||||
|
if (error)
|
||||||
|
goto out;
|
||||||
|
envv = ay_to_strv (v_envv, NULL);
|
||||||
|
argv = ay_to_strv (v_argv, &argc);
|
||||||
|
|
||||||
message_len = recvfrom (s, &byte, 1, MSG_TRUNC | MSG_PEEK, NULL, NULL);
|
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
||||||
|
"Factory invoked with working-dir='%s' display='%s' startup-id='%s'"
|
||||||
|
"workspace='%d'\n",
|
||||||
|
working_directory ? working_directory : "(null)",
|
||||||
|
display_name ? display_name : "(null)",
|
||||||
|
startup_id ? startup_id : "(null)",
|
||||||
|
initial_workspace);
|
||||||
|
|
||||||
message = g_malloc (message_len);
|
options = terminal_options_parse (working_directory,
|
||||||
|
display_name,
|
||||||
|
startup_id,
|
||||||
|
envv,
|
||||||
|
TRUE,
|
||||||
|
TRUE,
|
||||||
|
&argc, &argv,
|
||||||
|
&error,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (message == NULL) {
|
if (options != NULL)
|
||||||
return TRUE;
|
{
|
||||||
}
|
options->initial_workspace = initial_workspace;
|
||||||
|
|
||||||
message_len = recvfrom (s, message, message_len, 0, NULL, NULL);
|
terminal_app_handle_options (terminal_app_get (), options, FALSE /* no resume */, &error);
|
||||||
if (message_len < 0) {
|
terminal_options_free (options);
|
||||||
g_free (message);
|
}
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters = g_variant_new_from_data (G_VARIANT_TYPE ("(ayayayayiay)"), message, message_len, FALSE, NULL, NULL);
|
|
||||||
|
|
||||||
g_variant_get (parameters, "(@ay@ay@ay@ayi@ay)",
|
|
||||||
&v_wd, &v_display, &v_sid, &v_envv, &initial_workspace, &v_argv);
|
|
||||||
|
|
||||||
working_directory = ay_to_string (v_wd, &error);
|
|
||||||
if (error)
|
|
||||||
goto out;
|
|
||||||
display_name = ay_to_string (v_display, &error);
|
|
||||||
if (error)
|
|
||||||
goto out;
|
|
||||||
startup_id = ay_to_string (v_sid, &error);
|
|
||||||
if (error)
|
|
||||||
goto out;
|
|
||||||
envv = ay_to_strv (v_envv, NULL);
|
|
||||||
argv = ay_to_strv (v_argv, &argc);
|
|
||||||
|
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
|
||||||
"Factory invoked with working-dir='%s' display='%s' startup-id='%s'"
|
|
||||||
"workspace='%d'\n",
|
|
||||||
working_directory ? working_directory : "(null)",
|
|
||||||
display_name ? display_name : "(null)",
|
|
||||||
startup_id ? startup_id : "(null)",
|
|
||||||
initial_workspace);
|
|
||||||
|
|
||||||
options = terminal_options_parse (working_directory,
|
|
||||||
display_name,
|
|
||||||
startup_id,
|
|
||||||
envv,
|
|
||||||
TRUE,
|
|
||||||
TRUE,
|
|
||||||
&argc, &argv,
|
|
||||||
&error,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (options != NULL) {
|
|
||||||
options->initial_workspace = initial_workspace;
|
|
||||||
|
|
||||||
terminal_app_handle_options (terminal_app_get (), options, FALSE /* no resume */, &error);
|
|
||||||
terminal_options_free (options);
|
|
||||||
}
|
|
||||||
out:
|
out:
|
||||||
g_variant_unref (v_wd);
|
g_variant_unref (v_wd);
|
||||||
g_free (working_directory);
|
g_free (working_directory);
|
||||||
g_variant_unref (v_display);
|
g_variant_unref (v_display);
|
||||||
g_free (display_name);
|
g_free (display_name);
|
||||||
g_variant_unref (v_sid);
|
g_variant_unref (v_sid);
|
||||||
g_free (startup_id);
|
g_free (startup_id);
|
||||||
g_variant_unref (v_envv);
|
g_variant_unref (v_envv);
|
||||||
g_strfreev (envv);
|
g_strfreev (envv);
|
||||||
g_variant_unref (v_argv);
|
g_variant_unref (v_argv);
|
||||||
g_strfreev (argv);
|
g_strfreev (argv);
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error == NULL)
|
||||||
g_error_free (error);
|
{
|
||||||
|
g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_gerror (invocation, error);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (message);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
static void send_ask_open (const char *name, OwnData *data)
|
bus_acquired_cb (GDBusConnection *connection,
|
||||||
|
const char *name,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
static const char dbus_introspection_xml[] =
|
||||||
|
"<node name='/org/mate/Terminal'>"
|
||||||
|
"<interface name='org.mate.Terminal.Factory'>"
|
||||||
|
"<method name='HandleArguments'>"
|
||||||
|
"<arg type='ay' name='working_directory' direction='in' />"
|
||||||
|
"<arg type='ay' name='display_name' direction='in' />"
|
||||||
|
"<arg type='ay' name='startup_id' direction='in' />"
|
||||||
|
"<arg type='ay' name='environment' direction='in' />"
|
||||||
|
"<arg type='i' name='workspace' direction='in' />"
|
||||||
|
"<arg type='ay' name='arguments' direction='in' />"
|
||||||
|
"</method>"
|
||||||
|
"</interface>"
|
||||||
|
"</node>";
|
||||||
|
|
||||||
|
static const GDBusInterfaceVTable interface_vtable =
|
||||||
|
{
|
||||||
|
method_call_cb,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
OwnData *data = (OwnData *) user_data;
|
||||||
|
GDBusNodeInfo *introspection_data;
|
||||||
|
guint registration_id;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
||||||
|
"Bus %s acquired\n", name);
|
||||||
|
|
||||||
|
introspection_data = g_dbus_node_info_new_for_xml (dbus_introspection_xml, NULL);
|
||||||
|
g_assert (introspection_data != NULL);
|
||||||
|
|
||||||
|
registration_id = g_dbus_connection_register_object (connection,
|
||||||
|
TERMINAL_FACTORY_SERVICE_PATH,
|
||||||
|
introspection_data->interfaces[0],
|
||||||
|
&interface_vtable,
|
||||||
|
NULL, NULL,
|
||||||
|
&error);
|
||||||
|
g_dbus_node_info_unref (introspection_data);
|
||||||
|
|
||||||
|
if (registration_id == 0)
|
||||||
|
{
|
||||||
|
g_printerr ("Failed to register object: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
data->exit_code = EXIT_FAILURE;
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
name_acquired_cb (GDBusConnection *connection,
|
||||||
|
const char *name,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
OwnData *data = (OwnData *) user_data;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
||||||
|
"Acquired the name %s on the session bus\n", name);
|
||||||
|
|
||||||
|
if (data->options == NULL)
|
||||||
|
{
|
||||||
|
/* Name re-acquired!? */
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!terminal_app_handle_options (terminal_app_get (), data->options, TRUE /* do resume */, &error))
|
||||||
|
{
|
||||||
|
g_printerr ("Failed to handle options: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
data->exit_code = EXIT_FAILURE;
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
terminal_options_free (data->options);
|
||||||
|
data->options = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
name_lost_cb (GDBusConnection *connection,
|
||||||
|
const char *name,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
OwnData *data = (OwnData *) user_data;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
char **envv;
|
char **envv;
|
||||||
int i;
|
int i;
|
||||||
|
@ -242,22 +315,23 @@ static void send_ask_open (const char *name, OwnData *data)
|
||||||
GString *string;
|
GString *string;
|
||||||
char *s;
|
char *s;
|
||||||
gsize len;
|
gsize len;
|
||||||
struct sockaddr_un unix_dest;
|
|
||||||
int fd_u, ret;
|
|
||||||
|
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
_terminal_debug_print (TERMINAL_DEBUG_FACTORY,
|
||||||
"Sending message to %s on the unix socket\n", name);
|
"Lost the name %s on the session bus\n", name);
|
||||||
|
|
||||||
|
/* Couldn't get the connection? No way to continue! */
|
||||||
|
if (connection == NULL)
|
||||||
|
{
|
||||||
|
data->exit_code = EXIT_FAILURE;
|
||||||
|
gtk_main_quit ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data->options == NULL)
|
if (data->options == NULL)
|
||||||
{
|
{
|
||||||
/* Already handled */
|
/* Already handled */
|
||||||
data->exit_code = EXIT_SUCCESS;
|
data->exit_code = EXIT_SUCCESS;
|
||||||
return;
|
gtk_main_quit ();
|
||||||
}
|
|
||||||
fd_u = socket (AF_UNIX, SOCK_DGRAM, 0);
|
|
||||||
|
|
||||||
if (fd_u < 0) {
|
|
||||||
data->exit_code = EXIT_FAILURE;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,21 +376,7 @@ static void send_ask_open (const char *name, OwnData *data)
|
||||||
g_variant_builder_add (&builder, "@ay",
|
g_variant_builder_add (&builder, "@ay",
|
||||||
g_variant_new_from_data (G_VARIANT_TYPE ("ay"), s, len, TRUE, g_free, s));
|
g_variant_new_from_data (G_VARIANT_TYPE ("ay"), s, len, TRUE, g_free, s));
|
||||||
|
|
||||||
GVariant *todo;
|
value = g_dbus_connection_call_sync (connection,
|
||||||
todo = g_variant_builder_end (&builder);
|
|
||||||
|
|
||||||
unix_dest.sun_family = AF_UNIX;
|
|
||||||
g_snprintf (unix_dest.sun_path, sizeof (unix_dest.sun_path), "%s%s%s%s%s", g_get_user_runtime_dir (), G_DIR_SEPARATOR_S, TERMINAL_FACTORY_UNIX_FOLDER, G_DIR_SEPARATOR_S, name);
|
|
||||||
|
|
||||||
g_free (subcadena);
|
|
||||||
ret = sendto (fd_u, g_variant_get_data (todo), g_variant_get_size (todo), 0, (struct sockaddr *) &unix_dest, sizeof (unix_dest));
|
|
||||||
if (ret < 0) {
|
|
||||||
g_printerr ("Failed to forward arguments: \n");
|
|
||||||
data->exit_code = EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
close (fd_u);
|
|
||||||
/*value = g_dbus_connection_call_sync (connection,
|
|
||||||
data->factory_name,
|
data->factory_name,
|
||||||
TERMINAL_FACTORY_SERVICE_PATH,
|
TERMINAL_FACTORY_SERVICE_PATH,
|
||||||
TERMINAL_FACTORY_INTERFACE_NAME,
|
TERMINAL_FACTORY_INTERFACE_NAME,
|
||||||
|
@ -326,17 +386,29 @@ static void send_ask_open (const char *name, OwnData *data)
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);*/
|
&error);
|
||||||
g_variant_unref (todo);
|
if (value == NULL)
|
||||||
data->exit_code = EXIT_SUCCESS;
|
{
|
||||||
|
g_printerr ("Failed to forward arguments: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
data->exit_code = EXIT_FAILURE;
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_variant_unref (value);
|
||||||
|
data->exit_code = EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
terminal_options_free (data->options);
|
terminal_options_free (data->options);
|
||||||
data->options = NULL;
|
data->options = NULL;
|
||||||
|
|
||||||
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Settings storage works as follows:
|
/* Settings storage works as follows:
|
||||||
* ~/.config/gatuno-terminal/config
|
* /apps/mate-terminal/global/
|
||||||
* ~/.config/gatuno-terminal/profiles/Foo/
|
* /apps/mate-terminal/profiles/Foo/
|
||||||
*
|
*
|
||||||
* It's somewhat tricky to manage the profiles/ dir since we need to track
|
* It's somewhat tricky to manage the profiles/ dir since we need to track
|
||||||
* the list of profiles, but GSettings doesn't have a concept of notifying that
|
* the list of profiles, but GSettings doesn't have a concept of notifying that
|
||||||
|
@ -412,11 +484,8 @@ get_factory_name_for_display (const char *display_name)
|
||||||
{
|
{
|
||||||
GString *name;
|
GString *name;
|
||||||
const char *p;
|
const char *p;
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen (TERMINAL_FACTORY_SERVICE_NAME_PREFIX) + strlen (display_name) + 10 /* NUL */;
|
name = g_string_sized_new (strlen (TERMINAL_FACTORY_SERVICE_NAME_PREFIX) + strlen (display_name) + 1 /* NUL */);
|
||||||
|
|
||||||
name = g_string_sized_new (len);
|
|
||||||
g_string_append (name, TERMINAL_FACTORY_SERVICE_NAME_PREFIX);
|
g_string_append (name, TERMINAL_FACTORY_SERVICE_NAME_PREFIX);
|
||||||
|
|
||||||
for (p = display_name; *p; ++p)
|
for (p = display_name; *p; ++p)
|
||||||
|
@ -433,83 +502,6 @@ get_factory_name_for_display (const char *display_name)
|
||||||
return g_string_free (name, FALSE);
|
return g_string_free (name, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_factory_unix_socket_folder (void) {
|
|
||||||
char path[8192];
|
|
||||||
|
|
||||||
g_snprintf (path, sizeof (path), "%s%s%s", g_get_user_runtime_dir (), G_DIR_SEPARATOR_S, TERMINAL_FACTORY_UNIX_FOLDER);
|
|
||||||
|
|
||||||
/* Crear el directorio de los sockets unix */
|
|
||||||
g_mkdir_with_parents (path, 0700);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_lock_factory (char *factory_name) {
|
|
||||||
char path[8192];
|
|
||||||
struct flock fl;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
g_snprintf (path, sizeof (path), "%s%s%s%s%s.lock", g_get_user_runtime_dir (), G_DIR_SEPARATOR_S, TERMINAL_FACTORY_UNIX_FOLDER, G_DIR_SEPARATOR_S, factory_name);
|
|
||||||
|
|
||||||
fd = open (path, O_RDWR | O_CREAT, 0600);
|
|
||||||
|
|
||||||
fl.l_start = 0;
|
|
||||||
fl.l_len = 0;
|
|
||||||
fl.l_type = F_WRLCK;
|
|
||||||
fl.l_whence = SEEK_SET;
|
|
||||||
if (fcntl(fd, F_SETLK, &fl) < 0) {
|
|
||||||
//fputs("Another instance of this program is running.\n", stderr);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
factory_fd_lock = fd;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void release_lock_factory (void) {
|
|
||||||
if (factory_fd_lock != -1) {
|
|
||||||
close (factory_fd_lock);
|
|
||||||
factory_fd_lock = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int do_bind_factory_unix_socket (char *factory_name) {
|
|
||||||
int s, ret;
|
|
||||||
struct sockaddr_un name;
|
|
||||||
|
|
||||||
s = socket (AF_UNIX, SOCK_DGRAM, 0);
|
|
||||||
|
|
||||||
if (s < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
name.sun_family = AF_UNIX;
|
|
||||||
g_snprintf (name.sun_path, sizeof (name.sun_path), "%s%s%s%s%s", g_get_user_runtime_dir (), G_DIR_SEPARATOR_S, TERMINAL_FACTORY_UNIX_FOLDER, G_DIR_SEPARATOR_S, factory_name);
|
|
||||||
|
|
||||||
unlink (name.sun_path);
|
|
||||||
|
|
||||||
ret = bind (s, (struct sockaddr *) &name, sizeof (name));
|
|
||||||
if (ret < 0) {
|
|
||||||
close (s);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void release_factory_unix_socket (char *factory_name) {
|
|
||||||
struct sockaddr_un name;
|
|
||||||
if (factory_unix_fd != -1) {
|
|
||||||
g_source_remove (factory_unix_watch);
|
|
||||||
factory_unix_watch = 0;
|
|
||||||
|
|
||||||
close (factory_unix_fd);
|
|
||||||
factory_unix_fd = -1;
|
|
||||||
|
|
||||||
g_snprintf (name.sun_path, sizeof (name.sun_path), "%s%s%s%s%s", g_get_user_runtime_dir (), G_DIR_SEPARATOR_S, TERMINAL_FACTORY_UNIX_FOLDER, G_DIR_SEPARATOR_S, factory_name);
|
|
||||||
unlink (name.sun_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_initial_workspace (void)
|
get_initial_workspace (void)
|
||||||
{
|
{
|
||||||
|
@ -583,6 +575,7 @@ main (int argc, char **argv)
|
||||||
&argc, &argv,
|
&argc, &argv,
|
||||||
&error,
|
&error,
|
||||||
gtk_get_option_group (TRUE),
|
gtk_get_option_group (TRUE),
|
||||||
|
egg_sm_client_get_option_group (),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (working_directory);
|
g_free (working_directory);
|
||||||
|
@ -621,65 +614,29 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
OwnData *data;
|
OwnData *data;
|
||||||
guint owner_id;
|
guint owner_id;
|
||||||
GError * error = NULL;
|
|
||||||
data = g_new (OwnData, 1);
|
data = g_new (OwnData, 1);
|
||||||
data->factory_name = get_factory_name_for_display (display_name);
|
data->factory_name = get_factory_name_for_display (display_name);
|
||||||
data->options = options;
|
data->options = options;
|
||||||
data->exit_code = -1;
|
data->exit_code = -1;
|
||||||
data->argv = argv_copy;
|
data->argv = argv_copy;
|
||||||
data->argc = argc_copy;
|
data->argc = argc_copy;
|
||||||
GIOChannel *io_channel;
|
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
options->initial_workspace = get_initial_workspace ();
|
options->initial_workspace = get_initial_workspace ();
|
||||||
|
|
||||||
/* El proceso del factory funciona así:
|
owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||||
* Si me pidieron usar el factory, intentar conseguir el candado.
|
data->factory_name,
|
||||||
* Si obtenemos el candado, poner el socket a la escucha.
|
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||||
* Si obtenemos el socket a la escucha, somos el factory. Lanzar terminal
|
bus_acquired_cb,
|
||||||
* Si no consigo el socket a la escucha, error. Lanzar terminal como si no hubiera factory.
|
name_acquired_cb,
|
||||||
* Si no obtengo el candado, enviar mensaje a la otra terminal.
|
name_lost_cb,
|
||||||
*/
|
data, NULL);
|
||||||
create_factory_unix_socket_folder ();
|
|
||||||
|
|
||||||
if (get_lock_factory (data->factory_name) == 0) {
|
gtk_main ();
|
||||||
factory_unix_fd = do_bind_factory_unix_socket (data->factory_name);
|
|
||||||
|
|
||||||
if (factory_unix_fd >= 0) {
|
|
||||||
/* Soy la factory */
|
|
||||||
_terminal_debug_print (TERMINAL_DEBUG_FACTORY, "Acquired the name %s on the unix socket\n", data->factory_name);
|
|
||||||
/* Instalar un vigilador del socket unix */
|
|
||||||
io_channel = g_io_channel_unix_new (factory_unix_fd);
|
|
||||||
|
|
||||||
factory_unix_watch = g_io_add_watch (io_channel, G_IO_IN, unix_socket_dgram_recv, NULL);
|
|
||||||
} else {
|
|
||||||
/* ¿Tengo lock pero no pude conseguir el socket unix? Raro, soltar el lock, puesto que no puedo recibir las peticiones del factory */
|
|
||||||
release_lock_factory ();
|
|
||||||
|
|
||||||
/* Correr la terminal de a solas */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Correr la terminal */
|
|
||||||
if (!terminal_app_handle_options (terminal_app_get (), data->options, TRUE /* do resume */, &error))
|
|
||||||
{
|
|
||||||
g_printerr ("Failed to handle options: %s\n", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
data->exit_code = EXIT_FAILURE;
|
|
||||||
} else {
|
|
||||||
terminal_options_free (data->options);
|
|
||||||
data->options = NULL;
|
|
||||||
|
|
||||||
gtk_main ();
|
|
||||||
}
|
|
||||||
|
|
||||||
release_factory_unix_socket (data->factory_name);
|
|
||||||
release_lock_factory ();
|
|
||||||
} else {
|
|
||||||
/* Ya hay otra factory corriendo, enviar el mensaje */
|
|
||||||
send_ask_open (data->factory_name, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = data->exit_code;
|
ret = data->exit_code;
|
||||||
|
g_bus_unown_name (owner_id);
|
||||||
|
|
||||||
g_free (data->factory_name);
|
g_free (data->factory_name);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
This file is part of Gatuno Terminal.
|
This file is part of MATE Terminal.
|
||||||
|
|
||||||
Gatuno Terminal is free software: you can redistribute it and/or modify
|
MATE Terminal is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Gatuno Terminal is distributed in the hope that it will be useful,
|
MATE Terminal is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Gatuno Terminal. If not, see <http://www.gnu.org/licenses/>.
|
along with MATE Terminal. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gatuno/terminal/ui">
|
<gresource prefix="/org/mate/terminal/ui">
|
||||||
<file compressed="true" preprocess="xml-stripblanks">encodings-dialog.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">encodings-dialog.ui</file>
|
||||||
<file compressed="true" preprocess="xml-stripblanks">find-dialog.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">find-dialog.ui</file>
|
||||||
<file compressed="true" preprocess="xml-stripblanks">keybinding-editor.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">keybinding-editor.ui</file>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
update-authors.pl is part of Gatuno Terminal.
|
update-authors.pl is part of MATE Terminal.
|
||||||
|
|
||||||
Gatuno Terminal is free software: you can redistribute it and/or modify
|
MATE Terminal is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Gatuno Terminal is distributed in the hope that it will be useful,
|
MATE Terminal is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Gatuno Terminal. If not, see <http://www.gnu.org/licenses/>.
|
along with MATE Terminal. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
use strict;
|
use strict;
|
||||||
|
|
Loading…
Reference in New Issue