|
Packit Service |
3bdf47 |
/*
|
|
Packit Service |
3bdf47 |
* Copyright © 2001, 2002 Havoc Pennington, Red Hat Inc.
|
|
Packit Service |
3bdf47 |
* Copyright © 2008, 2011, 2012, 2013 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 |
|
|
Packit Service |
3bdf47 |
#include <uuid.h>
|
|
Packit Service |
3bdf47 |
#include <dconf.h>
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include <glib.h>
|
|
Packit Service |
3bdf47 |
#include <glib/gi18n.h>
|
|
Packit Service |
3bdf47 |
#include <gtk/gtk.h>
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#include "profile-editor.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-prefs.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-accels.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-app.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-debug.h"
|
|
Packit Service |
3bdf47 |
#include "terminal-schemas.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 |
PrefData *the_pref_data = NULL; /* global */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Bottom */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
prefs_dialog_help_button_clicked_cb (GtkWidget *button,
|
|
Packit Service |
3bdf47 |
PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
terminal_util_show_help ("pref");
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
prefs_dialog_close_button_clicked_cb (GtkWidget *button,
|
|
Packit Service |
3bdf47 |
PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gtk_widget_destroy (data->dialog);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Sidebar */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static inline GSimpleAction *
|
|
Packit Service |
3bdf47 |
lookup_action (GtkWindow *window,
|
|
Packit Service |
3bdf47 |
const char *name)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GAction *action;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
action = g_action_map_lookup_action (G_ACTION_MAP (window), name);
|
|
Packit Service |
3bdf47 |
g_return_val_if_fail (action != NULL, NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return G_SIMPLE_ACTION (action);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Update the sidebar (visibility of icons, sensitivity of menu entries) to reflect the default and the selected profiles. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_update (GtkListBox *box)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
int i;
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row;
|
|
Packit Service |
3bdf47 |
GSettings *profile;
|
|
Packit Service |
3bdf47 |
gs_unref_object GSettings *default_profile;
|
|
Packit Service |
3bdf47 |
GtkStack *stack;
|
|
Packit Service |
3bdf47 |
GtkMenuButton *button;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
default_profile = terminal_settings_list_ref_default_child (the_pref_data->profiles_list);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* GTK+ doesn't seem to like if a popover is assigned to multiple buttons at once
|
|
Packit Service |
3bdf47 |
* (not even temporarily), so make sure to remove it from the previous button first. */
|
|
Packit Service |
3bdf47 |
for (i = 0; (row = gtk_list_box_get_row_at_index (box, i)) != NULL; i++) {
|
|
Packit Service |
3bdf47 |
button = g_object_get_data (G_OBJECT (row), "popover-button");
|
|
Packit Service |
3bdf47 |
gtk_menu_button_set_popover (button, NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (i = 0; (row = gtk_list_box_get_row_at_index (box, i)) != NULL; i++) {
|
|
Packit Service |
3bdf47 |
profile = g_object_get_data (G_OBJECT (row), "gsettings");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gboolean is_selected_profile = (profile != NULL && profile == the_pref_data->selected_profile);
|
|
Packit Service |
3bdf47 |
gboolean is_default_profile = (profile != NULL && profile == default_profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
stack = g_object_get_data (G_OBJECT (row), "home-stack");
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (stack, is_default_profile ? "home" : "placeholder");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
stack = g_object_get_data (G_OBJECT (row), "popover-stack");
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (stack, is_selected_profile ? "button" : "placeholder");
|
|
Packit Service |
3bdf47 |
if (is_selected_profile) {
|
|
Packit Service |
3bdf47 |
g_simple_action_set_enabled (lookup_action (GTK_WINDOW (the_pref_data->dialog), "delete"), !is_default_profile);
|
|
Packit Service |
3bdf47 |
g_simple_action_set_enabled (lookup_action (GTK_WINDOW (the_pref_data->dialog), "set-as-default"), !is_default_profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkPopover *popover_menu = GTK_POPOVER (gtk_builder_get_object (the_pref_data->builder, "popover-menu"));
|
|
Packit Service |
3bdf47 |
button = g_object_get_data (G_OBJECT (row), "popover-button");
|
|
Packit Service |
3bdf47 |
gtk_menu_button_set_popover (button, GTK_WIDGET (popover_menu));
|
|
Packit Service |
3bdf47 |
gtk_popover_set_relative_to (popover_menu, GTK_WIDGET (button));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
update_window_title (void)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row = the_pref_data->selected_list_box_row;
|
|
Packit Service |
3bdf47 |
if (row == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GSettings *profile = g_object_get_data (G_OBJECT (row), "gsettings");
|
|
Packit Service |
3bdf47 |
GtkLabel *label = g_object_get_data (G_OBJECT (row), "label");
|
|
Packit Service |
3bdf47 |
const char *text = gtk_label_get_text (label);
|
|
Packit Service |
3bdf47 |
gs_free char *subtitle;
|
|
Packit Service |
3bdf47 |
gs_free char *title;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (profile == NULL) {
|
|
Packit Service |
3bdf47 |
subtitle = g_strdup (text);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
subtitle = g_strdup_printf (_("Profile “%s”"), text);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
title = g_strdup_printf (_("Preferences – %s"), subtitle);
|
|
Packit Service |
3bdf47 |
gtk_window_set_title (GTK_WINDOW (the_pref_data->dialog), title);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* A new entry is selected in the sidebar */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_row_selected_cb (GtkListBox *box,
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row,
|
|
Packit Service |
3bdf47 |
GtkStack *stack)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_prefs_unload ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* row can be NULL intermittently during a profile meta operations */
|
|
Packit Service |
3bdf47 |
g_free (the_pref_data->selected_profile_uuid);
|
|
Packit Service |
3bdf47 |
if (row != NULL) {
|
|
Packit Service |
3bdf47 |
the_pref_data->selected_profile = g_object_get_data (G_OBJECT (row), "gsettings");
|
|
Packit Service |
3bdf47 |
the_pref_data->selected_profile_uuid = g_strdup (g_object_get_data (G_OBJECT (row), "uuid"));
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
the_pref_data->selected_profile = NULL;
|
|
Packit Service |
3bdf47 |
the_pref_data->selected_profile_uuid = NULL;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
the_pref_data->selected_list_box_row = row;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_update (box);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (row != NULL) {
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile != NULL) {
|
|
Packit Service |
3bdf47 |
profile_prefs_load (the_pref_data->selected_profile_uuid, the_pref_data->selected_profile);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
char *stack_child_name = g_object_get_data (G_OBJECT (row), "stack_child_name");
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (stack, stack_child_name);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
update_window_title ();
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* A profile's name changed, perhaps externally */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_name_changed_cb (GtkLabel *label,
|
|
Packit Service |
3bdf47 |
GParamSpec *pspec,
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gtk_list_box_row_changed (row); /* trigger re-sorting */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (row == the_pref_data->selected_list_box_row)
|
|
Packit Service |
3bdf47 |
update_window_title ();
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Select a profile in the sidebar by UUID */
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
listbox_select_profile (const char *uuid)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row;
|
|
Packit Service |
3bdf47 |
for (int i = 0; (row = gtk_list_box_get_row_at_index (the_pref_data->listbox, i)) != NULL; i++) {
|
|
Packit Service |
3bdf47 |
const char *rowuuid = g_object_get_data (G_OBJECT (row), "uuid");
|
|
Packit Service |
3bdf47 |
if (g_strcmp0 (rowuuid, uuid) == 0) {
|
|
Packit Service |
3bdf47 |
g_signal_emit_by_name (row, "activate");
|
|
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 |
/* Create a new profile now, select it, update the UI. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_new_now (const char *name)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free char *uuid = terminal_app_new_profile (terminal_app_get (), NULL, name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_select_profile (uuid);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Clone the selected profile now, select it, update the UI. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_clone_now (const char *name)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *uuid = terminal_app_new_profile (terminal_app_get (), the_pref_data->selected_profile, name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_select_profile (uuid);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Rename the selected profile now, update the UI. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_rename_now (const char *name)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* This will automatically trigger a call to profile_name_changed_cb(). */
|
|
Packit Service |
3bdf47 |
g_settings_set_string (the_pref_data->selected_profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, name);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Delete the selected profile now, update the UI. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_delete_now (const char *dummy)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Prepare to select the next one, or if there's no such then the previous one. */
|
|
Packit Service |
3bdf47 |
int index = gtk_list_box_row_get_index (the_pref_data->selected_list_box_row);
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *new_selected_row = gtk_list_box_get_row_at_index (the_pref_data->listbox, index + 1);
|
|
Packit Service |
3bdf47 |
if (new_selected_row == NULL)
|
|
Packit Service |
3bdf47 |
new_selected_row = gtk_list_box_get_row_at_index (the_pref_data->listbox, index - 1);
|
|
Packit Service |
3bdf47 |
GSettings *new_selected_profile = g_object_get_data (G_OBJECT (new_selected_row), "gsettings");
|
|
Packit Service |
3bdf47 |
gs_free char *uuid = NULL;
|
|
Packit Service |
3bdf47 |
if (new_selected_profile != NULL)
|
|
Packit Service |
3bdf47 |
uuid = terminal_settings_list_dup_uuid_from_child (the_pref_data->profiles_list, new_selected_profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
terminal_app_remove_profile (terminal_app_get (), the_pref_data->selected_profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_select_profile (uuid);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* "Set as default" selected. Do it now without asking for confirmation. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_set_as_default_cb (GSimpleAction *simple,
|
|
Packit Service |
3bdf47 |
GVariant *parameter,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile_uuid == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* This will automatically trigger a call to listbox_update() via "default-changed". */
|
|
Packit Service |
3bdf47 |
terminal_settings_list_set_default_child (the_pref_data->profiles_list, the_pref_data->selected_profile_uuid);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
popover_dialog_cancel_clicked_cb (GtkButton *button,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkPopover *popover_dialog = GTK_POPOVER (gtk_builder_get_object (the_pref_data->builder, "popover-dialog"));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 22, 0)
|
|
Packit Service |
3bdf47 |
gtk_popover_popdown (popover_dialog);
|
|
Packit Service |
3bdf47 |
#else
|
|
Packit Service |
3bdf47 |
gtk_widget_hide (GTK_WIDGET (popover_dialog));
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
popover_dialog_ok_clicked_cb (GtkButton *button,
|
|
Packit Service |
3bdf47 |
void (*fn) (const char *))
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
|
|
Packit Service |
3bdf47 |
const char *name = gtk_entry_get_text (entry);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Perform what we came for */
|
|
Packit Service |
3bdf47 |
(*fn) (name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Hide/popdown the popover */
|
|
Packit Service |
3bdf47 |
popover_dialog_cancel_clicked_cb (button, NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
popover_dialog_closed_cb (GtkPopover *popover,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
|
|
Packit Service |
3bdf47 |
gtk_entry_set_text (entry, "");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkButton *ok = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-ok"));
|
|
Packit Service |
3bdf47 |
GtkButton *cancel = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-cancel"));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_matched (ok, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (popover_dialog_ok_clicked_cb), NULL);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_matched (cancel, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (popover_dialog_cancel_clicked_cb), NULL);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_matched (popover, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (popover_dialog_closed_cb), NULL);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Updates the OK button's sensitivity (insensitive if entry field is empty or whitespace only).
|
|
Packit Service |
3bdf47 |
* The entry's initial value and OK's initial sensitivity have to match in the .ui file. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
popover_dialog_notify_text_cb (GtkEntry *entry,
|
|
Packit Service |
3bdf47 |
GParamSpec *pspec,
|
|
Packit Service |
3bdf47 |
GtkWidget *ok)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free char *text = g_strchomp (g_strdup (gtk_entry_get_text (entry)));
|
|
Packit Service |
3bdf47 |
gtk_widget_set_sensitive (ok, text[0] != '\0');
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Common dialog for entering new profile name, or confirming deletion */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_popup_dialog (GtkWidget *relative_to,
|
|
Packit Service |
3bdf47 |
const char *header,
|
|
Packit Service |
3bdf47 |
const char *body,
|
|
Packit Service |
3bdf47 |
const char *entry_text,
|
|
Packit Service |
3bdf47 |
const char *ok_text,
|
|
Packit Service |
3bdf47 |
void (*fn) (const char *))
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkLabel *label1 = GTK_LABEL (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-label1"));
|
|
Packit Service |
3bdf47 |
gtk_label_set_text (label1, header);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkLabel *label2 = GTK_LABEL (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-label2"));
|
|
Packit Service |
3bdf47 |
gtk_label_set_text (label2, body);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
|
|
Packit Service |
3bdf47 |
if (entry_text != NULL) {
|
|
Packit Service |
3bdf47 |
gtk_entry_set_text (entry, entry_text);
|
|
Packit Service |
3bdf47 |
gtk_widget_show (GTK_WIDGET (entry));
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
gtk_entry_set_text (entry, "."); /* to make the OK button sensitive */
|
|
Packit Service |
3bdf47 |
gtk_widget_hide (GTK_WIDGET (entry));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkButton *ok = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-ok"));
|
|
Packit Service |
3bdf47 |
gtk_button_set_label (ok, ok_text);
|
|
Packit Service |
3bdf47 |
GtkButton *cancel = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-cancel"));
|
|
Packit Service |
3bdf47 |
GtkPopover *popover_dialog = GTK_POPOVER (gtk_builder_get_object (the_pref_data->builder, "popover-dialog"));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_connect (ok, "clicked", G_CALLBACK (popover_dialog_ok_clicked_cb), fn);
|
|
Packit Service |
3bdf47 |
g_signal_connect (cancel, "clicked", G_CALLBACK (popover_dialog_cancel_clicked_cb), NULL);
|
|
Packit Service |
3bdf47 |
g_signal_connect (popover_dialog, "closed", G_CALLBACK (popover_dialog_closed_cb), NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_popover_set_relative_to (popover_dialog, relative_to);
|
|
Packit Service |
3bdf47 |
gtk_popover_set_position (popover_dialog, GTK_POS_BOTTOM);
|
|
Packit Service |
3bdf47 |
gtk_popover_set_default_widget (popover_dialog, GTK_WIDGET (ok));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 22, 0)
|
|
Packit Service |
3bdf47 |
gtk_popover_popup (popover_dialog);
|
|
Packit Service |
3bdf47 |
#else
|
|
Packit Service |
3bdf47 |
gtk_widget_show (GTK_WIDGET (popover_dialog));
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_widget_grab_focus (entry_text != NULL ? GTK_WIDGET (entry) : GTK_WIDGET (cancel));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* "New" selected, ask for profile name */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_new_cb (GtkButton *button,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
profile_popup_dialog (GTK_WIDGET (the_pref_data->new_profile_button),
|
|
Packit Service |
3bdf47 |
_("New Profile"),
|
|
Packit Service |
3bdf47 |
_("Enter name for new profile with default settings:"),
|
|
Packit Service |
3bdf47 |
"",
|
|
Packit Service |
3bdf47 |
_("Create"),
|
|
Packit Service |
3bdf47 |
profile_new_now);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* "Clone" selected, ask for profile name */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_clone_cb (GSimpleAction *simple,
|
|
Packit Service |
3bdf47 |
GVariant *parameter,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free char *name = g_settings_get_string (the_pref_data->selected_profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *label = g_strdup_printf (_("Enter name for new profile based on “%s”:"), name);
|
|
Packit Service |
3bdf47 |
gs_free char *clone_name = g_strdup_printf (_("%s (Copy)"), name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_popup_dialog (GTK_WIDGET (the_pref_data->selected_list_box_row),
|
|
Packit Service |
3bdf47 |
_("Clone Profile"),
|
|
Packit Service |
3bdf47 |
label,
|
|
Packit Service |
3bdf47 |
clone_name,
|
|
Packit Service |
3bdf47 |
_("Clone"),
|
|
Packit Service |
3bdf47 |
profile_clone_now);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* "Rename" selected, ask for new name */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_rename_cb (GSimpleAction *simple,
|
|
Packit Service |
3bdf47 |
GVariant *parameter,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *name = g_settings_get_string (the_pref_data->selected_profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *label = g_strdup_printf (_("Enter new name for profile “%s”:"), name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_popup_dialog (GTK_WIDGET (the_pref_data->selected_list_box_row),
|
|
Packit Service |
3bdf47 |
_("Rename Profile"),
|
|
Packit Service |
3bdf47 |
label,
|
|
Packit Service |
3bdf47 |
name,
|
|
Packit Service |
3bdf47 |
_("Rename"),
|
|
Packit Service |
3bdf47 |
profile_rename_now);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* "Delete" selected, ask for confirmation */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
profile_delete_cb (GSimpleAction *simple,
|
|
Packit Service |
3bdf47 |
GVariant *parameter,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (the_pref_data->selected_profile == NULL)
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *name = g_settings_get_string (the_pref_data->selected_profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gs_free char *label = g_strdup_printf (_("Really delete profile “%s”?"), name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_popup_dialog (GTK_WIDGET (the_pref_data->selected_list_box_row),
|
|
Packit Service |
3bdf47 |
_("Delete Profile"),
|
|
Packit Service |
3bdf47 |
label,
|
|
Packit Service |
3bdf47 |
NULL,
|
|
Packit Service |
3bdf47 |
_("Delete"),
|
|
Packit Service |
3bdf47 |
profile_delete_now);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if !GTK_CHECK_VERSION (3, 22, 27)
|
|
Packit Service |
3bdf47 |
/* Avoid crash on PageUp and PageDown: bugs 791549 & 770703 */
|
|
Packit Service |
3bdf47 |
static gboolean
|
|
Packit Service |
3bdf47 |
listbox_key_press_event_cb (GtkListBox *box,
|
|
Packit Service |
3bdf47 |
GdkEventKey *event,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
switch (event->keyval) {
|
|
Packit Service |
3bdf47 |
case GDK_KEY_Page_Up:
|
|
Packit Service |
3bdf47 |
case GDK_KEY_Page_Down:
|
|
Packit Service |
3bdf47 |
case GDK_KEY_KP_Page_Up:
|
|
Packit Service |
3bdf47 |
case GDK_KEY_KP_Page_Down:
|
|
Packit Service |
3bdf47 |
return TRUE;
|
|
Packit Service |
3bdf47 |
default:
|
|
Packit Service |
3bdf47 |
return FALSE;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Create a (non-header) row of the sidebar, either a global or a profile entry. */
|
|
Packit Service |
3bdf47 |
static GtkListBoxRow *
|
|
Packit Service |
3bdf47 |
listbox_create_row (const char *name,
|
|
Packit Service |
3bdf47 |
const char *stack_child_name,
|
|
Packit Service |
3bdf47 |
const char *uuid,
|
|
Packit Service |
3bdf47 |
GSettings *gsettings /* adopted */,
|
|
Packit Service |
3bdf47 |
gpointer sort_order)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row = GTK_LIST_BOX_ROW (gtk_list_box_row_new ());
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_object_set_data_full (G_OBJECT (row), "stack_child_name", g_strdup (stack_child_name), g_free);
|
|
Packit Service |
3bdf47 |
g_object_set_data_full (G_OBJECT (row), "uuid", g_strdup (uuid), g_free);
|
|
Packit Service |
3bdf47 |
if (gsettings != NULL)
|
|
Packit Service |
3bdf47 |
g_object_set_data_full (G_OBJECT (row), "gsettings", gsettings, (GDestroyNotify)g_object_unref);
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (row), "sort_order", sort_order);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkBox *hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_start (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_end (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_top (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_bottom (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkLabel *label = GTK_LABEL (gtk_label_new (name));
|
|
Packit Service |
3bdf47 |
if (gsettings != NULL) {
|
|
Packit Service |
3bdf47 |
g_signal_connect (label, "notify::label", G_CALLBACK (profile_name_changed_cb), row);
|
|
Packit Service |
3bdf47 |
g_settings_bind (gsettings,
|
|
Packit Service |
3bdf47 |
TERMINAL_PROFILE_VISIBLE_NAME_KEY,
|
|
Packit Service |
3bdf47 |
label,
|
|
Packit Service |
3bdf47 |
"label",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
gtk_label_set_xalign (label, 0);
|
|
Packit Service |
3bdf47 |
gtk_box_pack_start (hbox, GTK_WIDGET (label), TRUE, TRUE, 0);
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (row), "label", label);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Always add the "default" symbol and the "menu" button, even on rows of global prefs.
|
|
Packit Service |
3bdf47 |
* Use GtkStack to possible achieve visibility:hidden on it.
|
|
Packit Service |
3bdf47 |
* This is so that all listbox rows have the same dimensions, and the width doesn't change
|
|
Packit Service |
3bdf47 |
* as you switch the default profile. */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkStack *popover_stack = GTK_STACK (gtk_stack_new ());
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_start (GTK_WIDGET (popover_stack), 6);
|
|
Packit Service |
3bdf47 |
GtkMenuButton *popover_button = GTK_MENU_BUTTON (gtk_menu_button_new ());
|
|
Packit Service |
3bdf47 |
gtk_button_set_relief (GTK_BUTTON (popover_button), GTK_RELIEF_NONE);
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (popover_stack, GTK_WIDGET (popover_button), "button");
|
|
Packit Service |
3bdf47 |
GtkLabel *popover_label = GTK_LABEL (gtk_label_new (""));
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (popover_stack, GTK_WIDGET (popover_label), "placeholder");
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (row), "popover-stack", popover_stack);
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (row), "popover-button", popover_button);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_box_pack_end (hbox, GTK_WIDGET (popover_stack), FALSE, FALSE, 0);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkStack *home_stack = GTK_STACK (gtk_stack_new ());
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_start (GTK_WIDGET (home_stack), 12);
|
|
Packit Service |
3bdf47 |
GtkImage *home_image = GTK_IMAGE (gtk_image_new_from_icon_name ("emblem-default-symbolic", GTK_ICON_SIZE_BUTTON));
|
|
Packit Service |
3bdf47 |
gtk_widget_set_tooltip_text (GTK_WIDGET (home_image), _("This is the default profile"));
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (home_stack, GTK_WIDGET (home_image), "home");
|
|
Packit Service |
3bdf47 |
GtkLabel *home_label = GTK_LABEL (gtk_label_new (""));
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (home_stack, GTK_WIDGET (home_label), "placeholder");
|
|
Packit Service |
3bdf47 |
g_object_set_data (G_OBJECT (row), "home-stack", home_stack);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_box_pack_end (hbox, GTK_WIDGET (home_stack), FALSE, FALSE, 0);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_container_add (GTK_CONTAINER (row), GTK_WIDGET (hbox));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_widget_show_all (GTK_WIDGET (row));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (popover_stack, "placeholder");
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (home_stack, "placeholder");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return row;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Add all the non-profile rows to the sidebar */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_add_all_globals (PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
row = listbox_create_row (_("General"),
|
|
Packit Service |
3bdf47 |
"general-prefs",
|
|
Packit Service |
3bdf47 |
NULL, NULL, (gpointer) 0);
|
|
Packit Service |
3bdf47 |
gtk_list_box_insert (data->listbox, GTK_WIDGET (row), -1);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
row = listbox_create_row (_("Shortcuts"),
|
|
Packit Service |
3bdf47 |
"shortcut-prefs",
|
|
Packit Service |
3bdf47 |
NULL, NULL, (gpointer) 1);
|
|
Packit Service |
3bdf47 |
gtk_list_box_insert (data->listbox, GTK_WIDGET (row), -1);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Remove all the profile rows from the sidebar */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_remove_all_profiles (PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
int i = 0;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
data->selected_profile = NULL;
|
|
Packit Service |
3bdf47 |
g_free (data->selected_profile_uuid);
|
|
Packit Service |
3bdf47 |
data->selected_profile_uuid = NULL;
|
|
Packit Service |
3bdf47 |
profile_prefs_unload ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (the_pref_data->listbox), 0);
|
|
Packit Service |
3bdf47 |
g_signal_emit_by_name (row, "activate");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
while ((row = gtk_list_box_get_row_at_index (data->listbox, i)) != NULL) {
|
|
Packit Service |
3bdf47 |
if (g_object_get_data (G_OBJECT (row), "gsettings") != NULL) {
|
|
Packit Service |
3bdf47 |
gtk_widget_destroy (GTK_WIDGET (row));
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
i++;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Add all the profiles to the sidebar */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_add_all_profiles (PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GList *list, *l;
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
list = terminal_settings_list_ref_children (data->profiles_list);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
for (l = list; l != NULL; l = l->next) {
|
|
Packit Service |
3bdf47 |
GSettings *profile = (GSettings *) l->data;
|
|
Packit Service |
3bdf47 |
gs_free gchar *text = g_settings_get_string (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
|
|
Packit Service |
3bdf47 |
gs_free gchar *uuid = terminal_settings_list_dup_uuid_from_child (data->profiles_list, profile);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
row = listbox_create_row (NULL,
|
|
Packit Service |
3bdf47 |
"profile-prefs",
|
|
Packit Service |
3bdf47 |
uuid,
|
|
Packit Service |
3bdf47 |
profile /* adopts */,
|
|
Packit Service |
3bdf47 |
(gpointer) 42);
|
|
Packit Service |
3bdf47 |
gtk_list_box_insert (data->listbox, GTK_WIDGET (row), -1);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_update (data->listbox); /* FIXME: This is not needed but I don't know why :-) */
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Re-add all the profiles to the sidebar.
|
|
Packit Service |
3bdf47 |
* This is called when a profile is added or removed, and also when the list of profiles is
|
|
Packit Service |
3bdf47 |
* modified externally.
|
|
Packit Service |
3bdf47 |
* Try to keep the selected profile, whenever possible.
|
|
Packit Service |
3bdf47 |
* When the list is modified externally, the terminal_settings_list_*() methods seem to preserve
|
|
Packit Service |
3bdf47 |
* the GSettings object for every profile that remains in the list. There's no guarantee however
|
|
Packit Service |
3bdf47 |
* that a newly created GSettings can't receive the same address that a ceased one used to have.
|
|
Packit Service |
3bdf47 |
* So don't rely on GSettings* to keep track of the selected profile, use the UUID instead. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listbox_readd_profiles (PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gs_free char *uuid = g_strdup (data->selected_profile_uuid);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_remove_all_profiles (data);
|
|
Packit Service |
3bdf47 |
listbox_add_all_profiles (data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (uuid != NULL)
|
|
Packit Service |
3bdf47 |
listbox_select_profile (uuid);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Create a header row ("Global" or "Profiles +") */
|
|
Packit Service |
3bdf47 |
static GtkWidget *
|
|
Packit Service |
3bdf47 |
listboxrow_create_header (const char *text,
|
|
Packit Service |
3bdf47 |
gboolean visible_button)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
GtkBox *hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_start (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_end (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_top (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_margin_bottom (GTK_WIDGET (hbox), 6);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkLabel *label = GTK_LABEL (gtk_label_new (NULL));
|
|
Packit Service |
3bdf47 |
gs_free char *markup = g_markup_printf_escaped ("%s", text);
|
|
Packit Service |
3bdf47 |
gtk_label_set_markup (label, markup);
|
|
Packit Service |
3bdf47 |
gtk_label_set_xalign (label, 0);
|
|
Packit Service |
3bdf47 |
gtk_box_pack_start (hbox, GTK_WIDGET (label), TRUE, TRUE, 0);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Always add a "new profile" button. Use GtkStack to possible achieve visibility:hidden on it.
|
|
Packit Service |
3bdf47 |
* This is so that both header rows have the same dimensions. */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkStack *stack = GTK_STACK (gtk_stack_new ());
|
|
Packit Service |
3bdf47 |
GtkButton *button = GTK_BUTTON (gtk_button_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_BUTTON));
|
|
Packit Service |
3bdf47 |
gtk_button_set_relief (button, GTK_RELIEF_NONE);
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (stack, GTK_WIDGET (button), "button");
|
|
Packit Service |
3bdf47 |
GtkLabel *labelx = GTK_LABEL (gtk_label_new (""));
|
|
Packit Service |
3bdf47 |
gtk_stack_add_named (stack, GTK_WIDGET (labelx), "placeholder");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_box_pack_end (hbox, GTK_WIDGET (stack), FALSE, FALSE, 0);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_widget_show_all (GTK_WIDGET (hbox));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (visible_button) {
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (stack, "button");
|
|
Packit Service |
3bdf47 |
g_signal_connect (button, "clicked", G_CALLBACK (profile_new_cb), NULL);
|
|
Packit Service |
3bdf47 |
the_pref_data->new_profile_button = GTK_WIDGET (button);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
gtk_stack_set_visible_child_name (stack, "placeholder");
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return GTK_WIDGET (hbox);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Manage the creation or removal of the header row ("Global" or "Profiles +") */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
listboxrow_update_header (GtkListBoxRow *row,
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *before,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
if (before == NULL) {
|
|
Packit Service |
3bdf47 |
if (gtk_list_box_row_get_header (row) == NULL) {
|
|
Packit Service |
3bdf47 |
gtk_list_box_row_set_header (row, listboxrow_create_header (_("Global"), FALSE));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
return;
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GSettings *profile = g_object_get_data (G_OBJECT (row), "gsettings");
|
|
Packit Service |
3bdf47 |
if (profile != NULL) {
|
|
Packit Service |
3bdf47 |
GSettings *profile_before = g_object_get_data (G_OBJECT (before), "gsettings");
|
|
Packit Service |
3bdf47 |
if (profile_before != NULL) {
|
|
Packit Service |
3bdf47 |
gtk_list_box_row_set_header (row, NULL);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
if (gtk_list_box_row_get_header (row) == NULL) {
|
|
Packit Service |
3bdf47 |
gtk_list_box_row_set_header (row, listboxrow_create_header (_("Profiles"), TRUE));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Sort callback for rows of the sidebar (global and profile ones).
|
|
Packit Service |
3bdf47 |
* Global ones are kept at the top in fixed order. This is implemented via sort_order
|
|
Packit Service |
3bdf47 |
* which is an integer disguised as a pointer for ease of implementation.
|
|
Packit Service |
3bdf47 |
* Profile ones are sorted lexicographically. */
|
|
Packit Service |
3bdf47 |
static gint
|
|
Packit Service |
3bdf47 |
listboxrow_compare_cb (GtkListBoxRow *row1,
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row2,
|
|
Packit Service |
3bdf47 |
gpointer user_data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gpointer sort_order_1 = g_object_get_data (G_OBJECT (row1), "sort_order");
|
|
Packit Service |
3bdf47 |
gpointer sort_order_2 = g_object_get_data (G_OBJECT (row2), "sort_order");
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (sort_order_1 != sort_order_2)
|
|
Packit Service |
3bdf47 |
return sort_order_1 < sort_order_2 ? -1 : 1;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkLabel *label1 = g_object_get_data (G_OBJECT (row1), "label");
|
|
Packit Service |
3bdf47 |
const char *text1 = gtk_label_get_text (label1);
|
|
Packit Service |
3bdf47 |
GtkLabel *label2 = g_object_get_data (G_OBJECT (row2), "label");
|
|
Packit Service |
3bdf47 |
const char *text2 = gtk_label_get_text (label2);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
return g_utf8_collate (text1, text2);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Keybindings tab */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Make sure the treeview is repainted with the correct text color, see bug 792139. */
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
shortcuts_button_toggled_cb (GtkWidget *widget,
|
|
Packit Service |
3bdf47 |
GtkTreeView *tree_view)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* misc */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
static void
|
|
Packit Service |
3bdf47 |
prefs_dialog_destroy_cb (GtkWidget *widget,
|
|
Packit Service |
3bdf47 |
PrefData *data)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
/* Don't run this handler again */
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_by_func (widget, G_CALLBACK (prefs_dialog_destroy_cb), data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_by_func (data->profiles_list,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (listbox_readd_profiles), data);
|
|
Packit Service |
3bdf47 |
g_signal_handlers_disconnect_by_func (data->profiles_list,
|
|
Packit Service |
3bdf47 |
G_CALLBACK (listbox_update), data->listbox);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_destroy ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_object_unref (data->builder);
|
|
Packit Service |
3bdf47 |
g_free (data->selected_profile_uuid);
|
|
Packit Service |
3bdf47 |
g_free (data);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
void
|
|
Packit Service |
3bdf47 |
terminal_prefs_show_preferences (GSettings *profile, const char *widget_name)
|
|
Packit Service |
3bdf47 |
{
|
|
Packit Service |
3bdf47 |
TerminalApp *app = terminal_app_get ();
|
|
Packit Service |
3bdf47 |
PrefData *data;
|
|
Packit Service |
3bdf47 |
GtkWidget *dialog, *tree_view;
|
|
Packit Service |
3bdf47 |
GtkWidget *show_menubar_button, *disable_mnemonics_button, *disable_menu_accel_button;
|
|
Packit Service |
3bdf47 |
GtkWidget *disable_shortcuts_button;
|
|
Packit Service |
3bdf47 |
GtkWidget *theme_variant_label, *theme_variant_combo;
|
|
Packit Service |
3bdf47 |
GtkWidget *new_terminal_mode_label, *new_terminal_mode_combo;
|
|
Packit Service |
3bdf47 |
GtkWidget *close_button, *help_button;
|
|
Packit Service |
3bdf47 |
GSettings *settings;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
const GActionEntry action_entries[] = {
|
|
Packit Service |
3bdf47 |
{ "clone", profile_clone_cb, NULL, NULL, NULL },
|
|
Packit Service |
3bdf47 |
{ "rename", profile_rename_cb, NULL, NULL, NULL },
|
|
Packit Service |
3bdf47 |
{ "delete", profile_delete_cb, NULL, NULL, NULL },
|
|
Packit Service |
3bdf47 |
{ "set-as-default", profile_set_as_default_cb, NULL, NULL, NULL },
|
|
Packit Service |
3bdf47 |
};
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (the_pref_data != NULL)
|
|
Packit Service |
3bdf47 |
goto done;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
the_pref_data = g_new0 (PrefData, 1);
|
|
Packit Service |
3bdf47 |
data = the_pref_data;
|
|
Packit Service |
3bdf47 |
data->profiles_list = terminal_app_get_profiles_list (app);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* FIXME this method is only used from here. Inline it here instead. */
|
|
Packit Service |
3bdf47 |
data->builder = terminal_util_load_widgets_resource ("/org/gnome/terminal/ui/preferences.ui",
|
|
Packit Service |
3bdf47 |
"preferences-dialog",
|
|
Packit Service |
3bdf47 |
"preferences-dialog", &dialog,
|
|
Packit Service |
3bdf47 |
"close-button", &close_button,
|
|
Packit Service |
3bdf47 |
"help-button", &help_button,
|
|
Packit Service |
3bdf47 |
"default-show-menubar-checkbutton", &show_menubar_button,
|
|
Packit Service |
3bdf47 |
"theme-variant-label", &theme_variant_label,
|
|
Packit Service |
3bdf47 |
"theme-variant-combobox", &theme_variant_combo,
|
|
Packit Service |
3bdf47 |
"new-terminal-mode-label", &new_terminal_mode_label,
|
|
Packit Service |
3bdf47 |
"new-terminal-mode-combobox", &new_terminal_mode_combo,
|
|
Packit Service |
3bdf47 |
"disable-mnemonics-checkbutton", &disable_mnemonics_button,
|
|
Packit Service |
3bdf47 |
"disable-shortcuts-checkbutton", &disable_shortcuts_button,
|
|
Packit Service |
3bdf47 |
"disable-menu-accel-checkbutton", &disable_menu_accel_button,
|
|
Packit Service |
3bdf47 |
"accelerators-treeview", &tree_view,
|
|
Packit Service |
3bdf47 |
"the-stack", &data->stack,
|
|
Packit Service |
3bdf47 |
"the-listbox", &data->listbox,
|
|
Packit Service |
3bdf47 |
NULL);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
data->dialog = dialog;
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_window_set_application (GTK_WINDOW (data->dialog), GTK_APPLICATION (terminal_app_get ()));
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
terminal_util_bind_mnemonic_label_sensitivity (dialog);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
settings = terminal_app_get_global_settings (app);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_action_map_add_action_entries (G_ACTION_MAP (dialog),
|
|
Packit Service |
3bdf47 |
action_entries, G_N_ELEMENTS (action_entries),
|
|
Packit Service |
3bdf47 |
data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Sidebar */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_list_box_set_header_func (GTK_LIST_BOX (data->listbox),
|
|
Packit Service |
3bdf47 |
listboxrow_update_header,
|
|
Packit Service |
3bdf47 |
NULL,
|
|
Packit Service |
3bdf47 |
NULL);
|
|
Packit Service |
3bdf47 |
g_signal_connect (data->listbox, "row-selected", G_CALLBACK (listbox_row_selected_cb), data->stack);
|
|
Packit Service |
3bdf47 |
gtk_list_box_set_sort_func (data->listbox, listboxrow_compare_cb, NULL, NULL);
|
|
Packit Service |
3bdf47 |
#if !GTK_CHECK_VERSION (3, 22, 27)
|
|
Packit Service |
3bdf47 |
g_signal_connect (data->listbox, "key-press-event", G_CALLBACK (listbox_key_press_event_cb), NULL);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
listbox_add_all_globals (data);
|
|
Packit Service |
3bdf47 |
listbox_add_all_profiles (data);
|
|
Packit Service |
3bdf47 |
g_signal_connect_swapped (data->profiles_list, "children-changed",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (listbox_readd_profiles), data);
|
|
Packit Service |
3bdf47 |
g_signal_connect_swapped (data->profiles_list, "default-changed",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (listbox_update), data->listbox);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
GtkEntry *entry = GTK_ENTRY (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-entry"));
|
|
Packit Service |
3bdf47 |
GtkButton *ok = GTK_BUTTON (gtk_builder_get_object (the_pref_data->builder, "popover-dialog-ok"));
|
|
Packit Service |
3bdf47 |
g_signal_connect (entry, "notify::text", G_CALLBACK (popover_dialog_notify_text_cb), ok);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* General page */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gboolean shell_shows_menubar;
|
|
Packit Service |
3bdf47 |
g_object_get (gtk_settings_get_default (),
|
|
Packit Service |
3bdf47 |
"gtk-shell-shows-menubar", &shell_shows_menubar,
|
|
Packit Service |
3bdf47 |
NULL);
|
|
Packit Service |
3bdf47 |
if (shell_shows_menubar) {
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (show_menubar_button, FALSE);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY,
|
|
Packit Service |
3bdf47 |
show_menubar_button,
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#if GTK_CHECK_VERSION (3, 19, 0)
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_THEME_VARIANT_KEY,
|
|
Packit Service |
3bdf47 |
theme_variant_combo,
|
|
Packit Service |
3bdf47 |
"active-id",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
#else
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (theme_variant_label, FALSE);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (theme_variant_combo, FALSE);
|
|
Packit Service |
3bdf47 |
#endif /* GTK+ 3.19 */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
#ifndef DISUNIFY_NEW_TERMINAL_SECTION
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_NEW_TERMINAL_MODE_KEY,
|
|
Packit Service |
3bdf47 |
new_terminal_mode_combo,
|
|
Packit Service |
3bdf47 |
"active-id",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
#else
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (new_terminal_mode_label, FALSE);
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (new_terminal_mode_combo, FALSE);
|
|
Packit Service |
3bdf47 |
#endif
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
if (shell_shows_menubar) {
|
|
Packit Service |
3bdf47 |
gtk_widget_set_visible (disable_mnemonics_button, FALSE);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_ENABLE_MNEMONICS_KEY,
|
|
Packit Service |
3bdf47 |
disable_mnemonics_button,
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
|
|
Packit Service |
3bdf47 |
disable_menu_accel_button,
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Shortcuts page */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_settings_bind (settings,
|
|
Packit Service |
3bdf47 |
TERMINAL_SETTING_ENABLE_SHORTCUTS_KEY,
|
|
Packit Service |
3bdf47 |
disable_shortcuts_button,
|
|
Packit Service |
3bdf47 |
"active",
|
|
Packit Service |
3bdf47 |
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_connect (disable_shortcuts_button, "toggled",
|
|
Packit Service |
3bdf47 |
G_CALLBACK (shortcuts_button_toggled_cb), tree_view);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
terminal_accels_fill_treeview (tree_view, disable_shortcuts_button);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* Profile page */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
profile_prefs_init ();
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
/* misc */
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_signal_connect (close_button, "clicked", G_CALLBACK (prefs_dialog_close_button_clicked_cb), data);
|
|
Packit Service |
3bdf47 |
g_signal_connect (help_button, "clicked", G_CALLBACK (prefs_dialog_help_button_clicked_cb), data);
|
|
Packit Service |
3bdf47 |
g_signal_connect (dialog, "destroy", G_CALLBACK (prefs_dialog_destroy_cb), data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &the_pref_data);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
done:
|
|
Packit Service |
3bdf47 |
if (profile != NULL) {
|
|
Packit Service |
3bdf47 |
gs_free char *uuid = terminal_settings_list_dup_uuid_from_child (the_pref_data->profiles_list, profile);
|
|
Packit Service |
3bdf47 |
listbox_select_profile (uuid);
|
|
Packit Service |
3bdf47 |
} else {
|
|
Packit Service |
3bdf47 |
GtkListBoxRow *row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (the_pref_data->listbox), 0);
|
|
Packit Service |
3bdf47 |
g_signal_emit_by_name (row, "activate");
|
|
Packit Service |
3bdf47 |
}
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
terminal_util_dialog_focus_widget (the_pref_data->builder, widget_name);
|
|
Packit Service |
3bdf47 |
|
|
Packit Service |
3bdf47 |
gtk_window_present (GTK_WINDOW (the_pref_data->dialog));
|
|
Packit Service |
3bdf47 |
}
|