From 18ec266a0fcc920de7fab9aebcf8a23d5f48c6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Arreola=20Rodr=C3=ADguez?= Date: Sat, 17 Jul 2021 22:09:29 -0500 Subject: [PATCH] Arreglos a las configuraciones por defecto. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Arreglo la localización. --- Makefile.am | 7 +- configure.ac | 9 +- gatuno-terminal.appdata.xml.in | 16 +- po/Makefile.in.in | 269 +++++++++++++++++++++++++++++++++ po/POTFILES.in | 4 +- src/Makefile.am | 18 +-- src/keybinding-editor.ui | 2 +- src/profile-manager.ui | 2 +- src/profile-preferences.ui | 2 +- src/terminal-accels.c | 46 +++--- src/terminal-app.c | 101 ++++++------- src/terminal-app.h | 1 + src/terminal-profile.c | 42 +++-- src/terminal-window.c | 54 ++++--- src/terminal.c | 2 +- src/terminal.gresource.xml | 10 +- 16 files changed, 438 insertions(+), 147 deletions(-) create mode 100644 po/Makefile.in.in diff --git a/Makefile.am b/Makefile.am index 3fa23e0..c5f46eb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src po help +SUBDIRS = src po ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} @@ -9,7 +9,7 @@ DISTCHECK_CONFIGURE_FLAGS = \ --disable-silent-rules \ CFLAGS='-Wno-deprecated-declarations' -#INTLTOOL_XML_RULE@ +@INTLTOOL_XML_RULE@ appdatadir = $(datadir)/metainfo appdata_in_files = gatuno-terminal.appdata.xml.in appdata_DATA = $(appdata_in_files:.xml.in=.xml) @@ -17,7 +17,8 @@ appdata_DATA = $(appdata_in_files:.xml.in=.xml) desktopdir = $(datadir)/applications desktop_in_files = @PACKAGE@.desktop.in.in desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) -#INTLTOOL_DESKTOP_RULE@ + +@INTLTOOL_DESKTOP_RULE@ man_MANS = gatuno-terminal.1 diff --git a/configure.ac b/configure.ac index f94b4d9..2c28c5a 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ PKG_PROG_PKG_CONFIG AC_PROG_CC AC_HEADER_STDC AM_PROG_LIBTOOL -#IT_PROG_INTLTOOL([0.50.1]) +IT_PROG_INTLTOOL([0.50.1]) AM_GLIB_GNU_GETTEXT @@ -86,12 +86,6 @@ fi AM_CONDITIONAL([ENABLE_SKEY],[test "$enable_skey" = "yes"]) -# ************* -# Documentation -# ************* - -YELP_HELP_INIT - # **************************** AC_SUBST([TERMINAL_MAJOR_VERSION],[gt_version_major]) @@ -107,7 +101,6 @@ gatuno-terminal.desktop.in src/Makefile src/terminal-version.h src/skey/Makefile -help/Makefile po/Makefile.in ]) AC_OUTPUT diff --git a/gatuno-terminal.appdata.xml.in b/gatuno-terminal.appdata.xml.in index f3c4cff..1218531 100644 --- a/gatuno-terminal.appdata.xml.in +++ b/gatuno-terminal.appdata.xml.in @@ -1,22 +1,23 @@ - mate-terminal.desktop + gatuno-terminal.desktop CC0-1.0 GPL-3.0+ - MATE Terminal - <_summary>A terminal emulator for the MATE desktop environment + Gatuno Terminal + <_summary>A terminal emulator for you <_description>

- MATE Terminal is a terminal emulation application that you can use - to access a UNIX shell in the MATE environment. MATE Terminal emulates + Gatuno Terminal is a terminal emulation application that you can use + to access a UNIX shell in the destop environment. Gatuno Terminal emulates the xterm program developed by the X Consortium. It supports translucent backgrounds, opening multiple terminals in a single window (tabs) and clickable URLs.

- MATE Terminal is a fork 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 + Gatuno Terminal is a fork of Mate Terminal, which in turn is a fork + of GNOME Terminal and part of the MATE Desktop Environment. + If you would like to know more about Gatuno Terminal, please visit the project's home page.

@@ -39,5 +40,4 @@ http://www.mate-desktop.org mate-dev@ml.mate-desktop.org - MATE
diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..e56d7d6 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,269 @@ +# INTLTOOL_MAKEFILE +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# 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 to use GETTEXT_PACKAGE +# instead of PACKAGE and to look for po2tbl in ./ not in intl/ +# +# - Modified by jacob berkman 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: diff --git a/po/POTFILES.in b/po/POTFILES.in index d78325c..c402960 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,7 +1,7 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. -mate-terminal.appdata.xml.in -mate-terminal.desktop.in.in +gatuno-terminal.appdata.xml.in +gatuno-terminal.desktop.in.in src/profile-editor.c src/encodings-dialog.ui src/find-dialog.ui diff --git a/src/Makefile.am b/src/Makefile.am index de2b9c4..b05da3a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ BUILT_SOURCES = \ terminal-type-builtins.h \ $(NULL) -mate_terminal_SOURCES= \ +gatuno_terminal_SOURCES= \ eggshell.c \ eggshell.h \ profile-editor.c \ @@ -56,17 +56,17 @@ mate_terminal_SOURCES= \ $(NULL) if ENABLE_SKEY -mate_terminal_SOURCES += \ +gatuno_terminal_SOURCES += \ skey-popup.c \ skey-popup.h \ $(NULL) endif -nodist_mate_terminal_SOURCES= $(BUILT_SOURCES) +nodist_gatuno_terminal_SOURCES= $(BUILT_SOURCES) -mate_terminal_CPPFLAGS = \ +gatuno_terminal_CPPFLAGS = \ -DTERMINAL_COMPILATION \ - -DTERMINAL_RESOURCES_PATH_PREFIX="\"/org/mate/terminal\"" \ + -DTERMINAL_RESOURCES_PATH_PREFIX="\"/org/gatuno/terminal\"" \ -DTERM_DATADIR="\"$(datadir)\"" \ -DTERM_LOCALEDIR="\"$(datadir)/locale\"" \ -DTERM_PKGDATADIR="\"$(pkgdatadir)\"" \ @@ -82,14 +82,14 @@ mate_terminal_CPPFLAGS = \ $(DISABLE_DEPRECATED) \ $(AM_CPPFLAGS) -mate_terminal_CFLAGS = \ +gatuno_terminal_CFLAGS = \ $(TERM_CFLAGS) \ $(WARN_CFLAGS) \ $(AM_CFLAGS) -mate_terminal_LDFLAGS = -lICE +gatuno_terminal_LDFLAGS = -lICE -mate_terminal_LDADD = \ +gatuno_terminal_LDADD = \ skey/libskey.la \ $(TERM_LIBS) @@ -129,7 +129,7 @@ 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) $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $< -#INTLTOOL_XML_NOMERGE_RULE@ +##INTLTOOL_XML_NOMERGE_RULE@ CLEANFILES = \ stamp-terminal-type-builtins.h \ diff --git a/src/keybinding-editor.ui b/src/keybinding-editor.ui index ce49585..6e2a568 100644 --- a/src/keybinding-editor.ui +++ b/src/keybinding-editor.ui @@ -12,7 +12,7 @@ False 5 Keyboard Shortcuts - mate-terminal-accels + gatuno-terminal-accels dialog diff --git a/src/profile-manager.ui b/src/profile-manager.ui index 2e8b362..107005c 100644 --- a/src/profile-manager.ui +++ b/src/profile-manager.ui @@ -12,7 +12,7 @@ False 5 Profiles - mate-terminal-profile-manager + gatuno-terminal-profile-manager 400 300 dialog diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui index 131a810..1107bf5 100644 --- a/src/profile-preferences.ui +++ b/src/profile-preferences.ui @@ -231,7 +231,7 @@ Author: Wolfgang Ulbrich False 5 Profile Editor - mate-terminal-profile-editor + gatuno-terminal-profile-editor 600 400 True diff --git a/src/terminal-accels.c b/src/terminal-accels.c index 40fc9e4..030e7ff 100644 --- a/src/terminal-accels.c +++ b/src/terminal-accels.c @@ -382,7 +382,6 @@ static int inside_gsettings_notify = 0; static GtkWidget *edit_keys_dialog = NULL; static GtkTreeStore *edit_keys_store = NULL; static GHashTable *gsettings_key_to_entry; -static GKeyFile *settings_keybindings; static char* binding_name (guint keyval, @@ -408,12 +407,6 @@ void terminal_accels_init (void) { guint i, j; - gchar *concat; - - settings_keybindings = g_key_file_new (); - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/keybindings", NULL); - g_key_file_load_from_file (settings_keybindings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL); - g_free (concat); gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal); @@ -439,7 +432,7 @@ terminal_accels_init (void) gtk_accel_group_connect_by_path (notification_group, I_(key_entry->accel_path), key_entry->closure); - keys_change_notify (settings_keybindings, key_entry->gsettings_key, NULL); + keys_change_notify (terminal_app_get_global_settings (), key_entry->gsettings_key, NULL); } } @@ -450,14 +443,6 @@ terminal_accels_init (void) void terminal_accels_shutdown (void) { - gchar *concat; - - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/keybindings", NULL); - g_key_file_save_to_file (settings_keybindings, concat, NULL); - g_free (concat); - - g_key_file_free (settings_keybindings); - if (sync_idle_id != 0) { g_source_remove (sync_idle_id); @@ -502,12 +487,20 @@ keys_change_notify (GKeyFile *settings, KeyEntry *key_entry; GdkModifierType mask; guint keyval; + gboolean has_ini_value = TRUE; + GError *gerror = NULL; _terminal_debug_print (TERMINAL_DEBUG_ACCELS, "key %s changed\n", key); - val = g_key_file_get_string (settings, CONF_KEYS_SCHEMA, key, NULL); + val = g_key_file_get_string (settings, CONF_KEYS_SCHEMA, key, &gerror); + + if (gerror != NULL) { + g_error_free (gerror); + + has_ini_value = FALSE; + } #ifdef MATE_ENABLE_DEBUG _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS) @@ -520,7 +513,7 @@ keys_change_notify (GKeyFile *settings, val); } #endif - + key_entry = g_hash_table_lookup (gsettings_key_to_entry, key); if (!key_entry) { @@ -530,9 +523,11 @@ keys_change_notify (GKeyFile *settings, g_free (val); return; } - - if (!binding_from_string (val, &keyval, &mask)) - { + + if (has_ini_value == FALSE) { + keyval = key_entry->gsettings_keyval; + mask = key_entry->gsettings_mask; + } else if (!binding_from_string (val, &keyval, &mask)) { g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n", val ? val : "(null)", key_entry->gsettings_key); @@ -655,6 +650,7 @@ add_key_entry_to_changeset (gpointer key, 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); + keys_change_notify (changeset, key_entry->gsettings_key, NULL); g_free (accel_name); } } @@ -667,7 +663,7 @@ sync_idle_cb (gpointer data) sync_idle_id = 0; - g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, settings_keybindings); + g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, terminal_app_get_global_settings ()); return FALSE; } @@ -859,9 +855,10 @@ other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gset } #endif - g_key_file_set_string (settings_keybindings, CONF_KEYS_SCHEMA, + g_key_file_set_string (terminal_app_get_global_settings (), CONF_KEYS_SCHEMA, ke->gsettings_key, str); + keys_change_notify (terminal_app_get_global_settings (), ke->gsettings_key, NULL); g_free (str); } @@ -905,9 +902,10 @@ accel_cleared_callback (GtkCellRendererAccel *cell, "Cleared keybinding for GSettings %s", ke->gsettings_key); - g_key_file_set_string (settings_keybindings, CONF_KEYS_SCHEMA, + g_key_file_set_string (terminal_app_get_global_settings (), CONF_KEYS_SCHEMA, ke->gsettings_key, str); + keys_change_notify (terminal_app_get_global_settings (), ke->gsettings_key, NULL); g_free (str); } diff --git a/src/terminal-app.c b/src/terminal-app.c index eb1ccde..1a51cf0 100644 --- a/src/terminal-app.c +++ b/src/terminal-app.c @@ -91,8 +91,6 @@ struct _TerminalApp GtkWidget *manage_profiles_delete_button; GtkWidget *manage_profiles_default_menu; - GKeyFile *settings_global; - GHashTable *profiles; char* default_profile_id; TerminalProfile *default_profile; @@ -138,6 +136,7 @@ enum }; static TerminalApp *global_app = NULL; +static GKeyFile *settings_global = NULL; #define MONOSPACE_FONT_SCHEMA "org.mate.interface" #define MONOSPACE_FONT_KEY "monospace-font-name" @@ -163,6 +162,8 @@ static TerminalApp *global_app = NULL; */ /* 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* terminal_app_get_screen_by_display_name (const char *display_name, @@ -327,13 +328,15 @@ terminal_app_delete_profile (TerminalApp *app, GError *error = NULL; profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME); - profile_dir = g_strconcat ("~/.gatuno-terminal/", profile_name, NULL); + profile_dir = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", profile_name, NULL); /* Borrar el archivo */ g_unlink (profile_dir); - /* And remove the profile directory */ g_free (profile_dir); + + /* Volver a listar los perfiles para provocar que se actualicen */ + terminal_app_profile_list_notify_cb (app); } static void @@ -500,7 +503,8 @@ profile_combo_box_changed_cb (GtkWidget *widget, if (!profile) return; - g_key_file_set_string (app->settings_global, CONF_GLOBAL_SCHEMA, DEFAULT_PROFILE_KEY, terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)); + g_key_file_set_string (settings_global, CONF_GLOBAL_SCHEMA, DEFAULT_PROFILE_KEY, terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)); + terminal_app_default_profile_notify_cb (settings_global, DEFAULT_PROFILE_KEY, app); /* FIXME: ¿debería guardar el archivo? */ /* Even though the GSettings change notification does this, it happens too late. @@ -755,18 +759,10 @@ static gchar **terminal_app_profile_list_from_dir (TerminalApp *app) { int ret; gchar **profile_list = NULL; - profile_dir = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles", NULL); + profile_dir = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles", NULL); - /* Verificar que exista como directorio */ - if (g_file_test (profile_dir, G_FILE_TEST_IS_DIR)) { - /* Posiblemente no exista, intentar crear como directorio */ - ret = g_mkdir_with_parents (profile_dir, 0640); - } else if (g_file_test (profile_dir, G_FILE_TEST_EXISTS)) { - /* Si no es directorio, estamos en problemas */ - g_free (profile_dir); - - return 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); @@ -996,31 +992,15 @@ terminal_app_encoding_list_notify_cb (GKeyFile *settings, } static void -terminal_app_system_font_notify_cb (GKeyFile *settings, - gchar *key, - gpointer user_data) +terminal_app_system_set_default_font (TerminalApp *app) { - TerminalApp *app = TERMINAL_APP (user_data); - char *font = NULL; PangoFontDescription *font_desc; - if (strcmp (key, MONOSPACE_FONT_KEY) != 0) - return; - - font = g_key_file_get_string (settings, CONF_GLOBAL_SCHEMA, key, NULL); - if (!font) - font = g_strdup (DEFAULT_MONOSPACE_FONT); - g_assert (font != NULL); - - if (font && (strlen (font) == 0)) /* empty string */ - font = g_strdup (DEFAULT_MONOSPACE_FONT); - - font_desc = pango_font_description_from_string (font); + font_desc = pango_font_description_from_string (DEFAULT_MONOSPACE_FONT); if (app->system_font_desc && pango_font_description_equal (app->system_font_desc, font_desc)) { pango_font_description_free (font_desc); - g_free (font); return; } @@ -1030,7 +1010,6 @@ terminal_app_system_font_notify_cb (GKeyFile *settings, app->system_font_desc = font_desc; g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT); - g_free (font); } static void @@ -1122,13 +1101,15 @@ new_profile_response_cb (GtkWidget *new_profile_dialog, { confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("You already have a profile called “%s”. Can't have two profiles with the same name"), name); + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("You already have a profile called “%s”. Do you want to create another profile with the same name?"), name); /* Alternative button order was set automatically by GtkMessageDialog */ retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog)); gtk_widget_destroy (confirm_dialog); - goto cleanup; + if (retval == GTK_RESPONSE_NO) { + goto cleanup; + } } g_list_free (profiles); @@ -1141,7 +1122,7 @@ new_profile_response_cb (GtkWidget *new_profile_dialog, new_profile /* adopts the refcount */); terminal_profile_edit (new_profile, transient_parent, NULL); - + terminal_app_profile_list_notify_cb (app); cleanup: g_free (name); } @@ -1364,32 +1345,36 @@ terminal_app_init (TerminalApp *app) /* Initialise defaults */ app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS; 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->encodings = terminal_encodings_get_builtins (); - app->settings_global = g_key_file_new (); - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/config", NULL); - g_key_file_load_from_file (app->settings_global, concat, G_KEY_FILE_KEEP_COMMENTS, NULL); + /* Verificar que exista como directorio */ + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal", NULL); + /* Posiblemente no exista, intentar crear como directorio */ + g_mkdir_with_parents (concat, 0755); + g_free (concat); + + settings_global = g_key_file_new (); + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/config", NULL); + g_key_file_load_from_file (settings_global, concat, G_KEY_FILE_KEEP_COMMENTS, NULL); g_free (concat); /* Load the settings */ terminal_app_profile_list_notify_cb (app); - terminal_app_default_profile_notify_cb (app->settings_global, + terminal_app_default_profile_notify_cb (settings_global, DEFAULT_PROFILE_KEY, app); - terminal_app_encoding_list_notify_cb (app->settings_global, + terminal_app_encoding_list_notify_cb (settings_global, ENCODING_LIST_KEY, app); - terminal_app_system_font_notify_cb (app->settings_global, - MONOSPACE_FONT_KEY, - app); - terminal_app_enable_menu_accels_notify_cb (app->settings_global, + terminal_app_system_set_default_font (app); + terminal_app_enable_menu_accels_notify_cb (settings_global, ENABLE_MENU_BAR_ACCEL_KEY, app); - terminal_app_enable_mnemonics_notify_cb (app->settings_global, + terminal_app_enable_mnemonics_notify_cb (settings_global, ENABLE_MNEMONICS_KEY, app); @@ -1407,9 +1392,9 @@ terminal_app_finalize (GObject *object) gchar *concat; /* Guardar las configuraciones antes de salir */ - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/config", NULL); - g_key_file_save_to_file (app->settings_global, concat, NULL); - g_key_file_free (app->settings_global); + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/config", NULL); + g_key_file_save_to_file (settings_global, concat, NULL); + g_key_file_free (settings_global); g_free (concat); g_free (app->default_profile_id); @@ -1470,11 +1455,11 @@ terminal_app_set_property (GObject *object, { case PROP_ENABLE_MENU_BAR_ACCEL: app->enable_menu_accels = g_value_get_boolean (value); - g_key_file_set_boolean (app->settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels); + g_key_file_set_boolean (settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels); break; case PROP_ENABLE_MNEMONICS: app->enable_mnemonics = g_value_get_boolean (value); - g_key_file_set_boolean (app->settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MNEMONICS_KEY, app->enable_mnemonics); + g_key_file_set_boolean (settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MNEMONICS_KEY, app->enable_mnemonics); break; case PROP_DEFAULT_PROFILE: case PROP_SYSTEM_FONT: @@ -1572,6 +1557,10 @@ terminal_app_get (void) return global_app; } +GKeyFile *terminal_app_get_global_settings (void) { + return settings_global; +} + void terminal_app_shutdown (void) { diff --git a/src/terminal-app.h b/src/terminal-app.h index f787e37..2b0e9e6 100644 --- a/src/terminal-app.h +++ b/src/terminal-app.h @@ -82,6 +82,7 @@ typedef struct _TerminalApp TerminalApp; GType terminal_app_get_type (void); TerminalApp* terminal_app_get (void); +GKeyFile *terminal_app_get_global_settings (void); void terminal_app_shutdown (void); diff --git a/src/terminal-profile.c b/src/terminal-profile.c index 7d30e50..75d8a71 100644 --- a/src/terminal-profile.c +++ b/src/terminal-profile.c @@ -556,7 +556,7 @@ terminal_profile_ini_read (GKeyFile *settings, TerminalProfileClass *klass; GError *gerror = NULL; GParamSpec *pspec; - GValue value = { 0, }; + GValue value = { 0, }, *default_value; gboolean equal; gboolean force_set = FALSE; @@ -577,7 +577,9 @@ terminal_profile_ini_read (GKeyFile *settings, if (gerror != NULL) { /* No es un boolean, triste caso */ g_error_free (gerror); - goto out; + + default_value = g_param_spec_get_default_value (pspec); + res = g_value_get_boolean (default_value); } g_value_set_boolean (&value, res); @@ -588,6 +590,8 @@ terminal_profile_ini_read (GKeyFile *settings, 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; } @@ -601,7 +605,8 @@ terminal_profile_ini_read (GKeyFile *settings, if (gerror != NULL) { /* No es un entero, mal */ g_error_free (gerror); - goto out; + default_value = g_param_spec_get_default_value (pspec); + entero = g_value_get_enum (default_value); } g_value_set_enum (&value, entero); @@ -614,7 +619,15 @@ terminal_profile_ini_read (GKeyFile *settings, cadena = g_key_file_get_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL); if (cadena == NULL) { - goto out; + 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)) { @@ -631,7 +644,11 @@ terminal_profile_ini_read (GKeyFile *settings, cadena = g_key_file_get_string (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL); if (cadena == NULL) { - goto out; + 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)); @@ -644,7 +661,8 @@ terminal_profile_ini_read (GKeyFile *settings, if (gerror != NULL) { g_error_free (gerror); - goto out; + default_value = g_param_spec_get_default_value (pspec); + doble = g_value_get_double (default_value); } g_value_set_double (&value, doble); } @@ -656,7 +674,9 @@ terminal_profile_ini_read (GKeyFile *settings, if (gerror != NULL) { /* No es un entero, mal */ g_error_free (gerror); - goto out; + + default_value = g_param_spec_get_default_value (pspec); + entero = g_value_get_int (default_value); } g_value_set_int (&value, entero); @@ -670,7 +690,7 @@ terminal_profile_ini_read (GKeyFile *settings, color_strings = g_key_file_get_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL, NULL); 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); } n_colors = g_strv_length (color_strings); @@ -875,7 +895,7 @@ terminal_profile_save (TerminalProfile *profile) priv->dirty_pspecs = NULL; #endif - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL); + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL); was_saved = g_key_file_save_to_file (priv->settings, concat, &gerror); @@ -978,7 +998,7 @@ terminal_profile_constructor (GType type, g_assert (name != NULL); priv->settings = g_key_file_new (); - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL); + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL); g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL); g_free (concat); @@ -1132,7 +1152,7 @@ terminal_profile_set_property (GObject *object, gchar *concat; g_key_file_free (priv->settings); - concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL); + concat = g_strconcat (g_get_user_config_dir (), "/gatuno-terminal/profiles/", priv->profile_dir, NULL); priv->settings = g_key_file_new (); g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL); g_free (concat); diff --git a/src/terminal-window.c b/src/terminal-window.c index df6347c..f6c099f 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -159,10 +159,10 @@ static gboolean terminal_window_focus_in_event (GtkWidget *widget, static gboolean notebook_button_press_cb (GtkWidget *notebook, GdkEventButton *event, - GSettings *settings); + gpointer data); static gboolean window_key_press_cb (GtkWidget *notebook, GdkEventKey *event, - GSettings *settings); + gpointer data); static gboolean notebook_popup_menu_cb (GtkWidget *notebook, TerminalWindow *window); static void notebook_page_selected_callback (GtkWidget *notebook, @@ -2145,8 +2145,6 @@ terminal_window_init (TerminalWindow *window) GtkStyleContext *context; - GSettings *settings = g_settings_new ("org.mate.terminal.global"); - context = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (context, "mate-terminal"); @@ -2165,9 +2163,9 @@ terminal_window_init (TerminalWindow *window) gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE); gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window")); g_signal_connect (priv->notebook, "button-press-event", - G_CALLBACK (notebook_button_press_cb), settings); + G_CALLBACK (notebook_button_press_cb), NULL); g_signal_connect (window, "key-press-event", - G_CALLBACK (window_key_press_cb), settings); + G_CALLBACK (window_key_press_cb), NULL); g_signal_connect (priv->notebook, "popup-menu", G_CALLBACK (notebook_popup_menu_cb), window); g_signal_connect_after (priv->notebook, "switch-page", @@ -2864,7 +2862,7 @@ terminal_window_get_active (TerminalWindow *window) static gboolean notebook_button_press_cb (GtkWidget *widget, GdkEventButton *event, - GSettings *settings) + gpointer data) { TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget)); TerminalWindowPrivate *priv = window->priv; @@ -2876,9 +2874,17 @@ notebook_button_press_cb (GtkWidget *widget, int page_num; int before_pages; int later_pages; - - if ((event->type == GDK_BUTTON_PRESS && event->button == 2) && - (g_settings_get_boolean (settings, "middle-click-closes-tabs"))) + 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 (gerror != NULL) { + 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); if (tab_clicked >= 0) @@ -2936,9 +2942,19 @@ notebook_button_press_cb (GtkWidget *widget, static gboolean window_key_press_cb (GtkWidget *widget, GdkEventKey *event, - GSettings *settings) + gpointer data) { - if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs") && + gboolean tab_switches; + 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) { TerminalWindow *window = TERMINAL_WINDOW (widget); @@ -3499,11 +3515,11 @@ confirm_close_window_or_tab (TerminalWindow *window, { TerminalWindowPrivate *priv = window->priv; GtkWidget *dialog; - GSettings *settings; gboolean do_confirm; gboolean has_processes; int n_tabs; char *confirm_msg; + GError *gerror = NULL; if (priv->confirm_close_dialog) { @@ -3511,10 +3527,14 @@ confirm_close_window_or_tab (TerminalWindow *window, gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog), GTK_RESPONSE_DELETE_EVENT); } - - settings = g_settings_new (CONF_GLOBAL_SCHEMA); - do_confirm = g_settings_get_boolean (settings, "confirm-window-close"); - g_object_unref (settings); + + do_confirm = g_key_file_get_boolean (terminal_app_get_global_settings (), CONF_GLOBAL_SCHEMA, "confirm-window-close", &gerror); + if (gerror != NULL) { + g_error_free (gerror); + + do_confirm = TRUE; + } + if (!do_confirm) return FALSE; diff --git a/src/terminal.c b/src/terminal.c index ce8432d..41ee52c 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -541,7 +541,7 @@ main (int argc, char **argv) textdomain (GETTEXT_PACKAGE); _terminal_debug_init (); - + /* Make a NULL-terminated copy since we may need it later */ argv_copy = g_new (char *, argc + 1); for (i = 0; i < argc; ++i) diff --git a/src/terminal.gresource.xml b/src/terminal.gresource.xml index e8ff1f1..f652a88 100644 --- a/src/terminal.gresource.xml +++ b/src/terminal.gresource.xml @@ -1,22 +1,22 @@ - + encodings-dialog.ui find-dialog.ui keybinding-editor.ui