|
Packit Service |
3bdf47 |
/*
|
|
Packit Service |
3bdf47 |
* Copyright © 2002 Havoc Pennington
|
|
Packit Service |
3bdf47 |
* Copyright © 2002 Mathias Hasselmann
|
|
Packit Service |
3bdf47 |
* Copyright © 2008, 2011, 2017 Christian Persch
|
|
Packit Service |
3bdf47 |
*
|
|
Packit Service |
3bdf47 |
* This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
3bdf47 |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
3bdf47 |
* the Free Software Foundation, either version 3 of the License, or
|
|
Packit Service |
3bdf47 |
* (at your option) any later version.
|
|
Packit Service |
3bdf47 |
*
|
|
Packit Service |
3bdf47 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
3bdf47 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
3bdf47 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
3bdf47 |
* GNU General Public License for more details.
|
|
Packit Service |
3bdf47 |
*
|
|
Packit Service |
3bdf47 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
3bdf47 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
3bdf47 |
*/
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include <config.h>
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include <string.h>
|
|
Packit Service |
3bdf47 |
#include <math.h>
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include <glib.h>
|
|
Packit Service |
3bdf47 |
#include <glib/gi18n.h>
|
|
Packit Service |
3bdf47 |
#include <gio/gio.h>
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include "terminal-app.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-encoding.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-enums.h"
|
|
Packit Service |
3bdf47 |
#include "profile-editor.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-prefs.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-schemas.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-type-builtins.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-util.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-profiles-list.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-libgsystem.h"
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Wrapper around g_signal_connect that maintains a list of the
|
|
Packit Service |
3bdf47 |
* handlers installed, and can disconnect them all. */
|
|
Packit Service |
3bdf47 |
typedef struct {
|
|
Packit Service |
3bdf47 |
gpointer instance;
|
|
Packit Service |
3bdf47 |
gulong handler_id;
|
|
Packit Service |
3bdf47 |
} ProfilePrefsSignal;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_register_signal_handler (gpointer instance,
|
|
Packit Service |
3bdf47 |
gulong handler_id)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
ProfilePrefsSignal sig;
|
|
Packit Service |
3bdf47 |
sig.instance = instance;
|
|
Packit Service |
3bdf47 |
sig.handler_id = handler_id;
|
|
Packit Service |
3bdf47 |
g_array_append_val (the_pref_data->profile_signals, sig);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gulong
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (gpointer instance,
|
|
Packit Service |
3bdf47 |
const gchar *detailed_signal,
|
|
Packit Service |
3bdf47 |
GCallback c_handler,
|
|
Packit Service |
3bdf47 |
gpointer data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gulong handler_id = g_signal_connect(instance, detailed_signal, c_handler, data);
|
|
Packit Service |
3bdf47 |
profile_prefs_register_signal_handler (instance, handler_id);
|
|
Packit Service |
3bdf47 |
return handler_id;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_handlers_disconnect_all (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
for (guint i = 0; i < the_pref_data->profile_signals->len; i++) {
|
|
Packit Service |
3bdf47 |
ProfilePrefsSignal *sig = &g_array_index (the_pref_data->profile_signals, ProfilePrefsSignal, i);
|
|
Packit Service |
3bdf47 |
g_signal_handler_disconnect (sig->instance, sig->handler_id);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
g_array_set_size (the_pref_data->profile_signals, 0);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Wrappers around g_settings_bind and friends that maintain a list of the
|
|
Packit Service |
3bdf47 |
* bindings installed, and can unbind them all. */
|
|
Packit Service |
3bdf47 |
typedef struct {
|
|
Packit Service |
3bdf47 |
gpointer object;
|
|
Packit Service |
3bdf47 |
char *property;
|
|
Packit Service |
3bdf47 |
} ProfilePrefsBinding;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_register_settings_binding (gpointer object,
|
|
Packit Service |
3bdf47 |
const char *property)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
ProfilePrefsBinding bind;
|
|
Packit Service |
3bdf47 |
bind.object = object;
|
|
Packit Service |
3bdf47 |
bind.property = g_strdup (property);
|
|
Packit Service |
3bdf47 |
g_array_append_val (the_pref_data->profile_bindings, bind);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (GSettings *settings,
|
|
Packit Service |
3bdf47 |
const gchar *key,
|
|
Packit Service |
3bdf47 |
gpointer object,
|
|
Packit Service |
3bdf47 |
const gchar *property,
|
|
Packit Service |
3bdf47 |
GSettingsBindFlags flags)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_register_settings_binding (object, property);
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings, key, object, property, flags);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (GSettings *settings,
|
|
Packit Service |
3bdf47 |
const gchar *key,
|
|
Packit Service |
3bdf47 |
gpointer object,
|
|
Packit Service |
3bdf47 |
const gchar *property,
|
|
Packit Service |
3bdf47 |
GSettingsBindFlags flags,
|
|
Packit Service |
3bdf47 |
GSettingsBindGetMapping get_mapping,
|
|
Packit Service |
3bdf47 |
GSettingsBindSetMapping set_mapping,
|
|
Packit Service |
3bdf47 |
gpointer user_data,
|
|
Packit Service |
3bdf47 |
GDestroyNotify destroy)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_register_settings_binding (object, property);
|
|
Packit Service |
3bdf47 |
g_settings_bind_with_mapping (settings, key, object, property, flags, get_mapping, set_mapping, user_data, destroy);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_writable (GSettings *settings,
|
|
Packit Service |
3bdf47 |
const gchar *key,
|
|
Packit Service |
3bdf47 |
gpointer object,
|
|
Packit Service |
3bdf47 |
const gchar *property,
|
|
Packit Service |
3bdf47 |
gboolean inverted)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_register_settings_binding (object, property);
|
|
Packit Service |
3bdf47 |
g_settings_bind_writable (settings, key, object, property, inverted);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_unbind_all (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
for (guint i = 0; i < the_pref_data->profile_bindings->len; i++) {
|
|
Packit Service |
3bdf47 |
ProfilePrefsBinding *bind = &g_array_index (the_pref_data->profile_bindings, ProfilePrefsBinding, i);
|
|
Packit Service |
3bdf47 |
g_settings_unbind (bind->object, bind->property);
|
|
Packit Service |
3bdf47 |
g_free (bind->property);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
g_array_set_size (the_pref_data->profile_bindings, 0);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
typedef struct _TerminalColorScheme TerminalColorScheme;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
struct _TerminalColorScheme
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
const char *name;
|
|
Packit Service |
3bdf47 |
const GdkRGBA foreground;
|
|
Packit Service |
3bdf47 |
const GdkRGBA background;
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#define COLOR(r, g, b) { .red = (r) / 255.0, .green = (g) / 255.0, .blue = (b) / 255.0, .alpha = 1.0 }
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static const TerminalColorScheme color_schemes[] = {
|
|
Packit Service |
3bdf47 |
{ N_("Black on light yellow"),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xdd)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
{ N_("Black on white"),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xff)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
{ N_("Gray on black"),
|
|
Packit Service |
3bdf47 |
COLOR (0xaa, 0xaa, 0xaa),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
{ N_("Green on black"),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xff, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
{ N_("White on black"),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
/* Translators: "Tango" is the name of a colour scheme, "light" can be translated */
|
|
Packit Service |
3bdf47 |
{ N_("Tango light"),
|
|
Packit Service |
3bdf47 |
COLOR (0x2e, 0x34, 0x36),
|
|
Packit Service |
3bdf47 |
COLOR (0xee, 0xee, 0xec)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
/* Translators: "Tango" is the name of a colour scheme, "dark" can be translated */
|
|
Packit Service |
3bdf47 |
{ N_("Tango dark"),
|
|
Packit Service |
3bdf47 |
COLOR (0xd3, 0xd7, 0xcf),
|
|
Packit Service |
3bdf47 |
COLOR (0x2e, 0x34, 0x36)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
/* Translators: "Solarized" is the name of a colour scheme, "light" can be translated */
|
|
Packit Service |
3bdf47 |
{ N_("Solarized light"),
|
|
Packit Service |
3bdf47 |
COLOR (0x65, 0x7B, 0x83),
|
|
Packit Service |
3bdf47 |
COLOR (0xfd, 0xf6, 0xe3)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
/* Translators: "Solarized" is the name of a colour scheme, "dark" can be translated */
|
|
Packit Service |
3bdf47 |
{ N_("Solarized dark"),
|
|
Packit Service |
3bdf47 |
COLOR (0x83, 0x94, 0x96),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x2b, 0x36)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#define TERMINAL_PALETTE_SIZE (16)
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
enum
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_TANGO = 0,
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_LINUX = 1,
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_XTERM = 2,
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_RXVT = 3,
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_SOLARIZED = 4,
|
|
Packit Service |
3bdf47 |
TERMINAL_PALETTE_N_BUILTINS
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static const GdkRGBA terminal_palettes[TERMINAL_PALETTE_N_BUILTINS][TERMINAL_PALETTE_SIZE] =
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
/* Tango palette */
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
COLOR (0x2e, 0x34, 0x36),
|
|
Packit Service |
3bdf47 |
COLOR (0xcc, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x4e, 0x9a, 0x06),
|
|
Packit Service |
3bdf47 |
COLOR (0xc4, 0xa0, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x34, 0x65, 0xa4),
|
|
Packit Service |
3bdf47 |
COLOR (0x75, 0x50, 0x7b),
|
|
Packit Service |
3bdf47 |
COLOR (0x06, 0x98, 0x9a),
|
|
Packit Service |
3bdf47 |
COLOR (0xd3, 0xd7, 0xcf),
|
|
Packit Service |
3bdf47 |
COLOR (0x55, 0x57, 0x53),
|
|
Packit Service |
3bdf47 |
COLOR (0xef, 0x29, 0x29),
|
|
Packit Service |
3bdf47 |
COLOR (0x8a, 0xe2, 0x34),
|
|
Packit Service |
3bdf47 |
COLOR (0xfc, 0xe9, 0x4f),
|
|
Packit Service |
3bdf47 |
COLOR (0x72, 0x9f, 0xcf),
|
|
Packit Service |
3bdf47 |
COLOR (0xad, 0x7f, 0xa8),
|
|
Packit Service |
3bdf47 |
COLOR (0x34, 0xe2, 0xe2),
|
|
Packit Service |
3bdf47 |
COLOR (0xee, 0xee, 0xec)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Linux palette */
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xaa, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xaa, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xaa, 0x55, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0xaa),
|
|
Packit Service |
3bdf47 |
COLOR (0xaa, 0x00, 0xaa),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xaa, 0xaa),
|
|
Packit Service |
3bdf47 |
COLOR (0xaa, 0xaa, 0xaa),
|
|
Packit Service |
3bdf47 |
COLOR (0x55, 0x55, 0x55),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x55, 0x55),
|
|
Packit Service |
3bdf47 |
COLOR (0x55, 0xff, 0x55),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0x55),
|
|
Packit Service |
3bdf47 |
COLOR (0x55, 0x55, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x55, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0x55, 0xff, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xff)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* XTerm palette */
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xcd, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0xcd, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0xee),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0x00, 0xcd),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xcd, 0xcd),
|
|
Packit Service |
3bdf47 |
COLOR (0xe5, 0xe5, 0xe5),
|
|
Packit Service |
3bdf47 |
COLOR (0x7f, 0x7f, 0x7f),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xff, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x5c, 0x5c, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x00, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xff, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xff)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* RXVT palette */
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xcd, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0xcd, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0xcd),
|
|
Packit Service |
3bdf47 |
COLOR (0xcd, 0x00, 0xcd),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xcd, 0xcd),
|
|
Packit Service |
3bdf47 |
COLOR (0xfa, 0xeb, 0xd7),
|
|
Packit Service |
3bdf47 |
COLOR (0x40, 0x40, 0x40),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x00, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xff, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x00, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0x00, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0xff, 0xff),
|
|
Packit Service |
3bdf47 |
COLOR (0xff, 0xff, 0xff)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Solarized palette (1.0.0beta2): http://ethanschoonover.com/solarized */
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
COLOR (0x07, 0x36, 0x42),
|
|
Packit Service |
3bdf47 |
COLOR (0xdc, 0x32, 0x2f),
|
|
Packit Service |
3bdf47 |
COLOR (0x85, 0x99, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0xb5, 0x89, 0x00),
|
|
Packit Service |
3bdf47 |
COLOR (0x26, 0x8b, 0xd2),
|
|
Packit Service |
3bdf47 |
COLOR (0xd3, 0x36, 0x82),
|
|
Packit Service |
3bdf47 |
COLOR (0x2a, 0xa1, 0x98),
|
|
Packit Service |
3bdf47 |
COLOR (0xee, 0xe8, 0xd5),
|
|
Packit Service |
3bdf47 |
COLOR (0x00, 0x2b, 0x36),
|
|
Packit Service |
3bdf47 |
COLOR (0xcb, 0x4b, 0x16),
|
|
Packit Service |
3bdf47 |
COLOR (0x58, 0x6e, 0x75),
|
|
Packit Service |
3bdf47 |
COLOR (0x65, 0x7b, 0x83),
|
|
Packit Service |
3bdf47 |
COLOR (0x83, 0x94, 0x96),
|
|
Packit Service |
3bdf47 |
COLOR (0x6c, 0x71, 0xc4),
|
|
Packit Service |
3bdf47 |
COLOR (0x93, 0xa1, 0xa1),
|
|
Packit Service |
3bdf47 |
COLOR (0xfd, 0xf6, 0xe3)
|
|
Packit Service |
3bdf47 |
},
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#undef COLOR
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void profile_colors_notify_scheme_combo_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
GtkComboBox *combo);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void profile_palette_notify_scheme_combo_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
GtkComboBox *combo);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void profile_palette_notify_colorpickers_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
gpointer user_data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* gdk_rgba_equal is too strict! */
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
rgba_equal (const GdkRGBA *a,
|
|
Packit Service |
3bdf47 |
const GdkRGBA *b)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gdouble dr, dg, db;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
dr = a->red - b->red;
|
|
Packit Service |
3bdf47 |
dg = a->green - b->green;
|
|
Packit Service |
3bdf47 |
db = a->blue - b->blue;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return (dr * dr + dg * dg + db * db) < 1e-4;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
palette_cmp (const GdkRGBA *ca,
|
|
Packit Service |
3bdf47 |
const GdkRGBA *cb)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
|
|
Packit Service |
3bdf47 |
if (!rgba_equal (&ca[i], &cb[i]))
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
palette_is_builtin (const GdkRGBA *colors,
|
|
Packit Service |
3bdf47 |
gsize n_colors,
|
|
Packit Service |
3bdf47 |
guint *n)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (n_colors != TERMINAL_PALETTE_SIZE)
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS; ++i)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (palette_cmp (colors, terminal_palettes[i]))
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
*n = i;
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
modify_palette_entry (GSettings *profile,
|
|
Packit Service |
3bdf47 |
guint i,
|
|
Packit Service |
3bdf47 |
const GdkRGBA *color)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free GdkRGBA *colors;
|
|
Packit Service |
3bdf47 |
gsize n_colors;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* FIXMEchpe: this can be optimised, don't really need to parse the colours! */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
colors = terminal_g_settings_get_rgba_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (i < n_colors)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
colors[i] = *color;
|
|
Packit Service |
3bdf47 |
terminal_g_settings_set_rgba_palette (profile, TERMINAL_PROFILE_PALETTE_KEY,
|
|
Packit Service |
3bdf47 |
colors, n_colors);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
color_scheme_combo_changed_cb (GtkWidget *combo,
|
|
Packit Service |
3bdf47 |
GParamSpec *pspec,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
i = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (i < G_N_ELEMENTS (color_schemes))
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
|
|
Packit Service |
3bdf47 |
terminal_g_settings_set_rgba (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, &color_schemes[i].foreground);
|
|
Packit Service |
3bdf47 |
terminal_g_settings_set_rgba (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, &color_schemes[i].background);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
else
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
/* "custom" selected, no change */
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_colors_notify_scheme_combo_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
GtkComboBox *combo)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GdkRGBA fg, bg;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
terminal_g_settings_get_rgba (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, &fg;;
|
|
Packit Service |
3bdf47 |
terminal_g_settings_get_rgba (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, &bg;;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (rgba_equal (&fg, &color_schemes[i].foreground) &&
|
|
Packit Service |
3bdf47 |
rgba_equal (&bg, &color_schemes[i].background))
|
|
Packit Service |
3bdf47 |
break;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
/* If we didn't find a match, then we get the last combo box item which is "custom" */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (combo, G_CALLBACK (color_scheme_combo_changed_cb), profile);
|
|
Packit Service |
3bdf47 |
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (combo, G_CALLBACK (color_scheme_combo_changed_cb), profile);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
palette_scheme_combo_changed_cb (GtkComboBox *combo,
|
|
Packit Service |
3bdf47 |
GParamSpec *pspec,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
int i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
i = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
|
|
Packit Service |
3bdf47 |
if (i < TERMINAL_PALETTE_N_BUILTINS)
|
|
Packit Service |
3bdf47 |
terminal_g_settings_set_rgba_palette (profile, TERMINAL_PROFILE_PALETTE_KEY,
|
|
Packit Service |
3bdf47 |
terminal_palettes[i], TERMINAL_PALETTE_SIZE);
|
|
Packit Service |
3bdf47 |
else
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
/* "custom" selected, no change */
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_palette_notify_scheme_combo_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
GtkComboBox *combo)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free GdkRGBA *colors;
|
|
Packit Service |
3bdf47 |
gsize n_colors;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
colors = terminal_g_settings_get_rgba_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
|
|
Packit Service |
3bdf47 |
if (!palette_is_builtin (colors, n_colors, &i))
|
|
Packit Service |
3bdf47 |
/* If we didn't find a match, then we want the last combo
|
|
Packit Service |
3bdf47 |
* box item which is "custom"
|
|
Packit Service |
3bdf47 |
*/
|
|
Packit Service |
3bdf47 |
i = TERMINAL_PALETTE_N_BUILTINS;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
|
|
Packit Service |
3bdf47 |
gtk_combo_box_set_active (combo, i);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
palette_color_notify_cb (GtkColorButton *button,
|
|
Packit Service |
3bdf47 |
GParamSpec *pspec,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GdkRGBA color;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color;;
|
|
Packit Service |
3bdf47 |
i = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (button), "palette-entry-index"));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), NULL);
|
|
Packit Service |
3bdf47 |
modify_palette_entry (profile, i, &color;;
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_palette_notify_colorpickers_cb (GSettings *profile,
|
|
Packit Service |
3bdf47 |
const char *key,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkWidget *w;
|
|
Packit Service |
3bdf47 |
GtkBuilder *builder = the_pref_data->builder;
|
|
Packit Service |
3bdf47 |
gs_free GdkRGBA *colors;
|
|
Packit Service |
3bdf47 |
gsize n_colors, i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_assert (strcmp (key, TERMINAL_PROFILE_PALETTE_KEY) == 0);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
colors = terminal_g_settings_get_rgba_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
n_colors = MIN (n_colors, TERMINAL_PALETTE_SIZE);
|
|
Packit Service |
3bdf47 |
for (i = 0; i < n_colors; i++)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
char name[32];
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_snprintf (name, sizeof (name), "palette-colorpicker-%" G_GSIZE_FORMAT, i);
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_block_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
|
|
Packit Service |
3bdf47 |
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (w), &colors[i]);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_unblock_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
custom_command_entry_changed_cb (GtkEntry *entry)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
const char *command;
|
|
Packit Service |
3bdf47 |
gs_free_error GError *error = NULL;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
command = gtk_entry_get_text (entry);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (command[0] == '\0' ||
|
|
Packit Service |
3bdf47 |
g_shell_parse_argv (command, NULL, NULL, &error))
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gtk_entry_set_icon_from_icon_name (entry, GTK_PACK_END, NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
else
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free char *tooltip;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_entry_set_icon_from_icon_name (entry, GTK_PACK_END, "dialog-warning");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
tooltip = g_strdup_printf (_("Error parsing command: %s"), error->message);
|
|
Packit Service |
3bdf47 |
gtk_entry_set_icon_tooltip_text (entry, GTK_PACK_END, tooltip);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
default_size_reset_cb (GtkWidget *button,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY);
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
cell_scale_reset_cb (GtkWidget *button,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_CELL_HEIGHT_SCALE_KEY);
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_CELL_WIDTH_SCALE_KEY);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
reset_compat_defaults_cb (GtkWidget *button,
|
|
Packit Service |
3bdf47 |
GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY);
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY);
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_ENCODING_KEY);
|
|
Packit Service |
3bdf47 |
g_settings_reset (profile, TERMINAL_PROFILE_CJK_UTF8_AMBIGUOUS_WIDTH_KEY);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/*
|
|
Packit Service |
3bdf47 |
* initialize widgets
|
|
Packit Service |
3bdf47 |
*/
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
set_input_hints(GtkWidget *entry)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 22, 20)
|
|
Packit Service |
3bdf47 |
gtk_entry_set_input_hints (GTK_ENTRY (entry), GTK_INPUT_HINT_NO_EMOJI);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
init_color_scheme_menu (GtkWidget *widget)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkCellRenderer *renderer;
|
|
Packit Service |
3bdf47 |
GtkTreeIter iter;
|
|
Packit Service |
3bdf47 |
gs_unref_object GtkListStore *store;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
store = gtk_list_store_new (1, G_TYPE_STRING);
|
|
Packit Service |
3bdf47 |
for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
|
|
Packit Service |
3bdf47 |
gtk_list_store_insert_with_values (store, &iter, -1,
|
|
Packit Service |
3bdf47 |
0, _(color_schemes[i].name),
|
|
Packit Service |
3bdf47 |
-1);
|
|
Packit Service |
3bdf47 |
gtk_list_store_insert_with_values (store, &iter, -1,
|
|
Packit Service |
3bdf47 |
0, _("Custom"),
|
|
Packit Service |
3bdf47 |
-1);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
renderer = gtk_cell_renderer_text_new ();
|
|
Packit Service |
3bdf47 |
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE);
|
|
Packit Service |
3bdf47 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, "text", 0, NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
enum {
|
|
Packit Service |
3bdf47 |
ENCODINGS_COLUMN_ID = 0,
|
|
Packit Service |
3bdf47 |
ENCODINGS_COLUMN_TEXT = 1
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
init_encodings_combo (GtkWidget *widget)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_unref_object GtkListStore *store = terminal_encodings_list_store_new (ENCODINGS_COLUMN_ID,
|
|
Packit Service |
3bdf47 |
ENCODINGS_COLUMN_TEXT);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Now turn on sorting */
|
|
Packit Service |
3bdf47 |
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
|
|
Packit Service |
3bdf47 |
ENCODINGS_COLUMN_TEXT,
|
|
Packit Service |
3bdf47 |
GTK_SORT_ASCENDING);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_combo_box_set_id_column (GTK_COMBO_BOX (widget), ENCODINGS_COLUMN_ID);
|
|
Packit Service |
3bdf47 |
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Cell renderer */
|
|
Packit Service |
3bdf47 |
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
|
|
Packit Service |
3bdf47 |
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE);
|
|
Packit Service |
3bdf47 |
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer,
|
|
Packit Service |
3bdf47 |
"text", ENCODINGS_COLUMN_TEXT, NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Tab scrolling was removed from GtkNotebook in gtk 3, so reimplement it here */
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
scroll_event_cb (GtkWidget *widget,
|
|
Packit Service |
3bdf47 |
GdkEventScroll *event,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
|
Packit Service |
3bdf47 |
GtkWidget *child, *event_widget, *action_widget;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if ((event->state & gtk_accelerator_get_default_mod_mask ()) != 0)
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
|
|
Packit Service |
3bdf47 |
if (child == NULL)
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
event_widget = gtk_get_event_widget ((GdkEvent *) event);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Ignore scroll events from the content of the page */
|
|
Packit Service |
3bdf47 |
if (event_widget == NULL ||
|
|
Packit Service |
3bdf47 |
event_widget == child ||
|
|
Packit Service |
3bdf47 |
gtk_widget_is_ancestor (event_widget, child))
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* And also from the action widgets */
|
|
Packit Service |
3bdf47 |
action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START);
|
|
Packit Service |
3bdf47 |
if (event_widget == action_widget ||
|
|
Packit Service |
3bdf47 |
(action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END);
|
|
Packit Service |
3bdf47 |
if (event_widget == action_widget ||
|
|
Packit Service |
3bdf47 |
(action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
switch (event->direction) {
|
|
Packit Service |
3bdf47 |
case GDK_SCROLL_RIGHT:
|
|
Packit Service |
3bdf47 |
case GDK_SCROLL_DOWN:
|
|
Packit Service |
3bdf47 |
gtk_notebook_next_page (notebook);
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
case GDK_SCROLL_LEFT:
|
|
Packit Service |
3bdf47 |
case GDK_SCROLL_UP:
|
|
Packit Service |
3bdf47 |
gtk_notebook_prev_page (notebook);
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
case GDK_SCROLL_SMOOTH:
|
|
Packit Service |
3bdf47 |
switch (gtk_notebook_get_tab_pos (notebook)) {
|
|
Packit Service |
3bdf47 |
case GTK_POS_LEFT:
|
|
Packit Service |
3bdf47 |
case GTK_POS_RIGHT:
|
|
Packit Service |
3bdf47 |
if (event->delta_y > 0)
|
|
Packit Service |
3bdf47 |
gtk_notebook_next_page (notebook);
|
|
Packit Service |
3bdf47 |
else if (event->delta_y < 0)
|
|
Packit Service |
3bdf47 |
gtk_notebook_prev_page (notebook);
|
|
Packit Service |
3bdf47 |
break;
|
|
Packit Service |
3bdf47 |
case GTK_POS_TOP:
|
|
Packit Service |
3bdf47 |
case GTK_POS_BOTTOM:
|
|
Packit Service |
3bdf47 |
if (event->delta_x > 0)
|
|
Packit Service |
3bdf47 |
gtk_notebook_next_page (notebook);
|
|
Packit Service |
3bdf47 |
else if (event->delta_x < 0)
|
|
Packit Service |
3bdf47 |
gtk_notebook_prev_page (notebook);
|
|
Packit Service |
3bdf47 |
break;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
s_to_rgba (GValue *value,
|
|
Packit Service |
3bdf47 |
GVariant *variant,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
const char *s;
|
|
Packit Service |
3bdf47 |
GdkRGBA color;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_variant_get (variant, "&s", &s);
|
|
Packit Service |
3bdf47 |
if (!gdk_rgba_parse (&color, s))
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
color.alpha = 1.0;
|
|
Packit Service |
3bdf47 |
g_value_set_boxed (value, &color;;
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static GVariant *
|
|
Packit Service |
3bdf47 |
rgba_to_s (const GValue *value,
|
|
Packit Service |
3bdf47 |
const GVariantType *expected_type,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GdkRGBA *color;
|
|
Packit Service |
3bdf47 |
gs_free char *s = NULL;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
color = g_value_get_boxed (value);
|
|
Packit Service |
3bdf47 |
if (color == NULL)
|
|
Packit Service |
3bdf47 |
return NULL;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
s = gdk_rgba_to_string (color);
|
|
Packit Service |
3bdf47 |
return g_variant_new_string (s);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
string_to_enum (GValue *value,
|
|
Packit Service |
3bdf47 |
GVariant *variant,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GType (* get_type) (void) = user_data;
|
|
Packit Service |
3bdf47 |
GEnumClass *klass;
|
|
Packit Service |
3bdf47 |
GEnumValue *eval = NULL;
|
|
Packit Service |
3bdf47 |
const char *s;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_variant_get (variant, "&s", &s);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
klass = g_type_class_ref (get_type ());
|
|
Packit Service |
3bdf47 |
for (i = 0; i < klass->n_values; ++i) {
|
|
Packit Service |
3bdf47 |
if (strcmp (klass->values[i].value_nick, s) != 0)
|
|
Packit Service |
3bdf47 |
continue;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
eval = &klass->values[i];
|
|
Packit Service |
3bdf47 |
break;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (eval)
|
|
Packit Service |
3bdf47 |
g_value_set_int (value, eval->value);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_type_class_unref (klass);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return eval != NULL;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static GVariant *
|
|
Packit Service |
3bdf47 |
enum_to_string (const GValue *value,
|
|
Packit Service |
3bdf47 |
const GVariantType *expected_type,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GType (* get_type) (void) = user_data;
|
|
Packit Service |
3bdf47 |
GEnumClass *klass;
|
|
Packit Service |
3bdf47 |
GEnumValue *eval = NULL;
|
|
Packit Service |
3bdf47 |
int val;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
GVariant *variant = NULL;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
val = g_value_get_int (value);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
klass = g_type_class_ref (get_type ());
|
|
Packit Service |
3bdf47 |
for (i = 0; i < klass->n_values; ++i) {
|
|
Packit Service |
3bdf47 |
if (klass->values[i].value != val)
|
|
Packit Service |
3bdf47 |
continue;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
eval = &klass->values[i];
|
|
Packit Service |
3bdf47 |
break;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (eval)
|
|
Packit Service |
3bdf47 |
variant = g_variant_new_string (eval->value_nick);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_type_class_unref (klass);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return variant;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
scrollbar_policy_to_bool (GValue *value,
|
|
Packit Service |
3bdf47 |
GVariant *variant,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
const char *str;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_variant_get (variant, "&s", &str);
|
|
Packit Service |
3bdf47 |
g_value_set_boolean (value, g_str_equal (str, "always"));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static GVariant *
|
|
Packit Service |
3bdf47 |
bool_to_scrollbar_policy (const GValue *value,
|
|
Packit Service |
3bdf47 |
const GVariantType *expected_type,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
return g_variant_new_string (g_value_get_boolean (value) ? "always" : "never");
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if !GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* ATTENTION: HACK HACK HACK!
|
|
Packit Service |
3bdf47 |
* GtkColorButton usability is broken. It always pops up the
|
|
Packit Service |
3bdf47 |
* GtkColorChooserDialog with show-editor=FALSE, which brings
|
|
Packit Service |
3bdf47 |
* up the dialogue in palette mode, when all we want is pick
|
|
Packit Service |
3bdf47 |
* a colour. Since there is no way to get to the colour
|
|
Packit Service |
3bdf47 |
* dialogue of the button, and the dialogue always sets
|
|
Packit Service |
3bdf47 |
* show-editor=FALSE in its map anyway, we need to override
|
|
Packit Service |
3bdf47 |
* the map implementation, set show-editor=TRUE and chain to
|
|
Packit Service |
3bdf47 |
* the parent's map. This is reasonably safe to do since that's
|
|
Packit Service |
3bdf47 |
* all the map functiondoes, and we can change this for _all_
|
|
Packit Service |
3bdf47 |
* colour chooser buttons, since they are used only in our
|
|
Packit Service |
3bdf47 |
* profile preferences dialogue.
|
|
Packit Service |
3bdf47 |
*/
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
fixup_color_chooser_dialog_map (GtkWidget *widget)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
g_object_set (GTK_COLOR_CHOOSER_DIALOG (widget), "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GTK_WIDGET_CLASS (g_type_class_peek_parent (GTK_COLOR_CHOOSER_DIALOG_GET_CLASS (widget)))->map (widget);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
fixup_color_chooser_button (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
static gboolean done = FALSE;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (!done) {
|
|
Packit Service |
3bdf47 |
GtkColorChooserDialogClass *klass;
|
|
Packit Service |
3bdf47 |
klass = g_type_class_ref (GTK_TYPE_COLOR_CHOOSER_DIALOG);
|
|
Packit Service |
3bdf47 |
g_assert (klass != NULL);
|
|
Packit Service |
3bdf47 |
GTK_WIDGET_CLASS (klass)->map = fixup_color_chooser_dialog_map;
|
|
Packit Service |
3bdf47 |
g_type_class_unref (klass);
|
|
Packit Service |
3bdf47 |
done = TRUE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#endif /* GTK+ < 3.19.8 HACK */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
monospace_filter (const PangoFontFamily *family,
|
|
Packit Service |
3bdf47 |
const PangoFontFace *face,
|
|
Packit Service |
3bdf47 |
gpointer data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
return pango_font_family_is_monospace ((PangoFontFamily *) family);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Called once per Preferences window, to initialize stuff that doesn't depend on the profile being edited */
|
|
Packit Service |
3bdf47 |
void
|
|
Packit Service |
3bdf47 |
profile_prefs_init (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkWidget *w;
|
|
Packit Service |
3bdf47 |
GtkBuilder *builder = the_pref_data->builder;
|
|
Packit Service |
3bdf47 |
char *text;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
the_pref_data->profile_signals = g_array_new (FALSE, FALSE, sizeof (ProfilePrefsSignal));
|
|
Packit Service |
3bdf47 |
the_pref_data->profile_bindings = g_array_new (FALSE, FALSE, sizeof (ProfilePrefsBinding));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if !GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
fixup_color_chooser_button ();
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "profile-editor-notebook");
|
|
Packit Service |
3bdf47 |
gtk_widget_add_events (w, GDK_BUTTON_PRESS_MASK | GDK_SCROLL_MASK);
|
|
Packit Service |
3bdf47 |
g_signal_connect (w, "scroll-event", G_CALLBACK (scroll_event_cb), NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox");
|
|
Packit Service |
3bdf47 |
init_color_scheme_menu (w);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "encoding-combobox");
|
|
Packit Service |
3bdf47 |
init_encodings_combo (w);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Translators: Appears as: [numeric entry] × width */
|
|
Packit Service |
3bdf47 |
text = g_strdup_printf ("× %s", _("width"));
|
|
Packit Service |
3bdf47 |
gtk_label_set_text ((GtkLabel *) gtk_builder_get_object (builder, "cell-width-scale-label"),
|
|
Packit Service |
3bdf47 |
text);
|
|
Packit Service |
3bdf47 |
g_free (text);
|
|
Packit Service |
3bdf47 |
/* Translators: Appears as: [numeric entry] × height */
|
|
Packit Service |
3bdf47 |
text = g_strdup_printf ("× %s", _("height"));
|
|
Packit Service |
3bdf47 |
gtk_label_set_text ((GtkLabel *) gtk_builder_get_object (builder, "cell-height-scale-label"),
|
|
Packit Service |
3bdf47 |
text);
|
|
Packit Service |
3bdf47 |
g_free (text);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Called each time the user switches away from a profile, so it's no longer being edited */
|
|
Packit Service |
3bdf47 |
void
|
|
Packit Service |
3bdf47 |
profile_prefs_unload (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_handlers_disconnect_all ();
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_unbind_all ();
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Called each time the user selects a new profile to edit */
|
|
Packit Service |
3bdf47 |
void
|
|
Packit Service |
3bdf47 |
profile_prefs_load (const char *uuid, GSettings *profile)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkWidget *w;
|
|
Packit Service |
3bdf47 |
GtkBuilder *builder = the_pref_data->builder;
|
|
Packit Service |
3bdf47 |
guint i;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_unload ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "profile-uuid")),
|
|
Packit Service |
3bdf47 |
uuid);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (gtk_builder_get_object (builder, "default-size-reset-button"),
|
|
Packit Service |
3bdf47 |
"clicked",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (default_size_reset_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (gtk_builder_get_object (builder, "cell-scale-reset-button"),
|
|
Packit Service |
3bdf47 |
"clicked",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (cell_scale_reset_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Hook up the palette colorpickers and combo box */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
char name[32];
|
|
Packit Service |
3bdf47 |
char *text;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_snprintf (name, sizeof (name), "palette-colorpicker-%u", i);
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (w), "palette-entry-index", GUINT_TO_POINTER (i));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
text = g_strdup_printf (_("Choose Palette Color %u"), i);
|
|
Packit Service |
3bdf47 |
gtk_color_button_set_title (GTK_COLOR_BUTTON (w), text);
|
|
Packit Service |
3bdf47 |
g_free (text);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
text = g_strdup_printf (_("Palette entry %u"), i);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_tooltip_text (w, text);
|
|
Packit Service |
3bdf47 |
g_free (text);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (w, "notify::rgba",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (palette_color_notify_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_palette_notify_colorpickers_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (profile_palette_notify_colorpickers_cb),
|
|
Packit Service |
3bdf47 |
NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "palette-combobox");
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (w, "notify::active",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (palette_scheme_combo_changed_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_palette_notify_scheme_combo_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, GTK_COMBO_BOX (w));
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (profile_palette_notify_scheme_combo_cb),
|
|
Packit Service |
3bdf47 |
w);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Hook up the color scheme pickers and combo box */
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox");
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (w, "notify::active",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (color_scheme_combo_changed_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_colors_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w));
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (profile, "changed::" TERMINAL_PROFILE_FOREGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (profile_colors_notify_scheme_combo_cb),
|
|
Packit Service |
3bdf47 |
w);
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (profile, "changed::" TERMINAL_PROFILE_BACKGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (profile_colors_notify_scheme_combo_cb),
|
|
Packit Service |
3bdf47 |
w);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "custom-command-entry"));
|
|
Packit Service |
3bdf47 |
custom_command_entry_changed_cb (GTK_ENTRY (w));
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (w, "changed",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (custom_command_entry_changed_cb), NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_signal_connect (gtk_builder_get_object (builder, "reset-compat-defaults-button"),
|
|
Packit Service |
3bdf47 |
"clicked",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (reset_compat_defaults_cb),
|
|
Packit Service |
3bdf47 |
profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "background-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_BACKGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_BACKSPACE_BINDING_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"backspace-binding-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
vte_erase_binding_get_type, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_BOLD_IS_BRIGHT_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "bold-is-bright-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"bold-color-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_INVERT_BOOLEAN |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "bold-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_INVERT_BOOLEAN |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_BOLD_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "cell-height-scale-spinbutton"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CELL_HEIGHT_SCALE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
|
|
Packit Service |
3bdf47 |
"value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "cell-width-scale-spinbutton"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CELL_WIDTH_SCALE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
|
|
Packit Service |
3bdf47 |
"value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CURSOR_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"cursor-colors-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "cursor-foreground-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CURSOR_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_FOREGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "cursor-background-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CURSOR_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_BACKGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_HIGHLIGHT_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"highlight-colors-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "highlight-foreground-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_HIGHLIGHT_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_HIGHLIGHT_FOREGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "highlight-background-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_HIGHLIGHT_COLORS_SET_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_HIGHLIGHT_BACKGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_SHAPE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"cursor-shape-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
vte_cursor_shape_get_type, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_BLINK_MODE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"cursor-blink-mode-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
vte_cursor_blink_mode_get_type, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_TEXT_BLINK_MODE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"text-blink-mode-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
vte_text_blink_mode_get_type, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "custom-command-entry"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "default-size-columns-spinbutton"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY,
|
|
Packit Service |
3bdf47 |
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
|
|
Packit Service |
3bdf47 |
"value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "default-size-rows-spinbutton"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY,
|
|
Packit Service |
3bdf47 |
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
|
|
Packit Service |
3bdf47 |
"value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"delete-binding-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
vte_erase_binding_get_type, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile, TERMINAL_PROFILE_EXIT_ACTION_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"exit-action-combobox"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
3bdf47 |
terminal_exit_action_get_type, NULL);
|
|
Packit Service |
3bdf47 |
w = (GtkWidget*) gtk_builder_get_object (builder, "font-selector");
|
|
Packit Service |
3bdf47 |
gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (w), monospace_filter, NULL, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_FONT_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"font-name", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "foreground-colorpicker"));
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 8)
|
|
Packit Service |
3bdf47 |
g_object_set (w, "show-editor", TRUE, NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_FOREGROUND_COLOR_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"rgba",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) s_to_rgba,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) rgba_to_s,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_LOGIN_SHELL_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"login-shell-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = GTK_WIDGET (gtk_builder_get_object (builder, "scrollback-lines-spinbutton"));
|
|
Packit Service |
3bdf47 |
set_input_hints (w);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_LINES_KEY,
|
|
Packit Service |
3bdf47 |
gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
|
|
Packit Service |
3bdf47 |
"value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"scrollback-limited-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_INVERT_BOOLEAN);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"scrollback-box"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_INVERT_BOOLEAN |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_with_mapping (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"scrollbar-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
3bdf47 |
(GSettingsBindGetMapping) scrollbar_policy_to_bool,
|
|
Packit Service |
3bdf47 |
(GSettingsBindSetMapping) bool_to_scrollbar_policy,
|
|
Packit Service |
3bdf47 |
NULL, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"scroll-on-keystroke-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"scroll-on-output-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"custom-font-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_INVERT_BOOLEAN);
|
|
Packit Service |
6eccb4 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
6eccb4 |
TERMINAL_PROFILE_TITLE_KEY,
|
|
Packit Service |
6eccb4 |
gtk_builder_get_object (builder, "title-entry"),
|
|
Packit Service |
6eccb4 |
"text",
|
|
Packit Service |
6eccb4 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
6eccb4 |
profile_prefs_settings_bind_with_mapping (profile,
|
|
Packit Service |
6eccb4 |
TERMINAL_PROFILE_TITLE_MODE_KEY,
|
|
Packit Service |
6eccb4 |
gtk_builder_get_object (builder,
|
|
Packit Service |
6eccb4 |
"title-mode-combobox"),
|
|
Packit Service |
6eccb4 |
"active",
|
|
Packit Service |
6eccb4 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
|
|
Packit Service |
6eccb4 |
(GSettingsBindGetMapping) string_to_enum,
|
|
Packit Service |
6eccb4 |
(GSettingsBindSetMapping) enum_to_string,
|
|
Packit Service |
6eccb4 |
terminal_title_mode_get_type, NULL);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"use-custom-command-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder,
|
|
Packit Service |
3bdf47 |
"use-theme-colors-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_AUDIBLE_BELL_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "bell-checkbutton"),
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "custom-command-entry-label"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "custom-command-entry"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "font-selector"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_USE_THEME_COLORS_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "colors-box"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN |
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind_writable (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_PALETTE_KEY,
|
|
Packit Service |
3bdf47 |
gtk_builder_get_object (builder, "palette-box"),
|
|
Packit Service |
3bdf47 |
"sensitive",
|
|
Packit Service |
3bdf47 |
FALSE);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Compatibility options */
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "encoding-combobox");
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_ENCODING_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"active-id", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
w = (GtkWidget *) gtk_builder_get_object (builder, "cjk-ambiguous-width-combobox");
|
|
Packit Service |
3bdf47 |
profile_prefs_settings_bind (profile, TERMINAL_PROFILE_CJK_UTF8_AMBIGUOUS_WIDTH_KEY,
|
|
Packit Service |
3bdf47 |
w,
|
|
Packit Service |
3bdf47 |
"active-id",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
6eccb4 |
|
|
Packit Service |
6eccb4 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
6eccb4 |
TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND,
|
|
Packit Service |
6eccb4 |
gtk_builder_get_object (builder, "use-transparent-background"),
|
|
Packit Service |
6eccb4 |
"active",
|
|
Packit Service |
6eccb4 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
6eccb4 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
6eccb4 |
TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND,
|
|
Packit Service |
6eccb4 |
gtk_builder_get_object (builder, "background-transparent-scale"),
|
|
Packit Service |
6eccb4 |
"sensitive",
|
|
Packit Service |
6eccb4 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY);
|
|
Packit Service |
6eccb4 |
profile_prefs_settings_bind (profile,
|
|
Packit Service |
6eccb4 |
TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT,
|
|
Packit Service |
6eccb4 |
gtk_builder_get_object (builder, "background-transparent-adjustment"),
|
|
Packit Service |
6eccb4 |
"value",
|
|
Packit Service |
6eccb4 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Called once per Preferences window, to destroy stuff that doesn't depend on the profile being edited */
|
|
Packit Service |
3bdf47 |
void
|
|
Packit Service |
3bdf47 |
profile_prefs_destroy (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_unload ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_array_free (the_pref_data->profile_signals, TRUE);
|
|
Packit Service |
3bdf47 |
g_array_free (the_pref_data->profile_bindings, TRUE);
|
|
Packit Service |
3bdf47 |
}
|