Commit 6b9e2523 authored by Robin Ericsson's avatar Robin Ericsson Committed by Robin Ericsson

mud-preferences.[ch] removed.

2004-07-18  Robin Ericsson  <lobbin@localhost.nu>

	* src/Makefile.am: mud-preferences.[ch] removed.

	* src/gconf-helper.c (gm_gconf_load_preferences): Rewritten to
	support profiles.

	* src/gnome-mud.c (main): Load profiles on startup.

	* src/mud-connection-view.c [_MudConnectionViewPrivate]: Removed
	prefs.
	(mud_connection_view_init): Changed callback for profile-change.
	(mud_connection_view_send): Now process command for separator.
	(mud_connection_view_set_*): Changed prefs to profile.
	(mud_connection_view_profile_changed_cb): Added callback for
	profile changes.
	(mud_connection_view_new): Now loads default profile.

	* src/mud-preferences.[ch]: Deleted.

	* src/mud-preferences-window.c [_MudPreferencesWindowPrivate]:
	Removed prefs, added profile and notification_count.
	[COLUMN_PREFERENCSE, COLUMN_ALIASE]: Added.
	[TAB_ALIASES]: Added.
	(mud_preferences_window_init): Connect callbacks.
	(mud_preferences_window_finalize): Disconnect callback.
	(mud_preferences_window_fill_profiles): Added aliases.
	(mud_preferences_window_tree_selection_cb): Added support for several
	tabs.
	(mud_preferences_window_change_profile_from_name): Added.
	(mud_preferences_window_change_profile): Added.
	(mud_preferences_window_connect_callbacks): Added.
	(mud_preferences_window_set_preferences): Added.
	(mud_preferences_window_*_cb): Changed preferences to profile and
	added return if notifying.

	* src/mud-profile.c [_MudProfilePrivate]: Added gconf_client, prefs
	and in_notification_count.
	(General): Moved a lot of functions from mud-preferences.c to
	mud-profile.c and renamed.

	* ui/main.glade: Added aliases tab.
parent 81451ef4
2004-07-18 Robin Ericsson <lobbin@localhost.nu>
* src/Makefile.am: mud-preferences.[ch] removed.
* src/gconf-helper.c (gm_gconf_load_preferences): Rewritten to
support profiles.
* src/gnome-mud.c (main): Load profiles on startup.
* src/mud-connection-view.c [_MudConnectionViewPrivate]: Removed
prefs.
(mud_connection_view_init): Changed callback for profile-change.
(mud_connection_view_send): Now process command for separator.
(mud_connection_view_set_*): Changed prefs to profile.
(mud_connection_view_profile_changed_cb): Added callback for
profile changes.
(mud_connection_view_new): Now loads default profile.
* src/mud-preferences.[ch]: Deleted.
* src/mud-preferences-window.c [_MudPreferencesWindowPrivate]:
Removed prefs, added profile and notification_count.
[COLUMN_PREFERENCSE, COLUMN_ALIASE]: Added.
[TAB_ALIASES]: Added.
(mud_preferences_window_init): Connect callbacks.
(mud_preferences_window_finalize): Disconnect callback.
(mud_preferences_window_fill_profiles): Added aliases.
(mud_preferences_window_tree_selection_cb): Added support for several
tabs.
(mud_preferences_window_change_profile_from_name): Added.
(mud_preferences_window_change_profile): Added.
(mud_preferences_window_connect_callbacks): Added.
(mud_preferences_window_set_preferences): Added.
(mud_preferences_window_*_cb): Changed preferences to profile and
added return if notifying.
* src/mud-profile.c [_MudProfilePrivate]: Added gconf_client, prefs
and in_notification_count.
(General): Moved a lot of functions from mud-preferences.c to
mud-profile.c and renamed.
* ui/main.glade: Added aliases tab.
2004-07-06 Jordi Mallach <jordi@sindominio.net>
* configure.ac: Bump libgnetwork requirement to 0.0.6.
......
......@@ -26,8 +26,6 @@ gnome_mud_SOURCES = \
gnome.mud.h \
mud-connection-view.c \
mud-connection-view.h \
mud-preferences.c \
mud-preferences.h \
mud-preferences-window.c \
mud-preferences-window.h \
mud-profile.c \
......
......@@ -11,14 +11,39 @@
#include "gconf-helper.h"
void gm_gconf_load_preferences(GConfClient *gconf_client, MudPrefs *prefs)
void gm_gconf_load_preferences(MudProfile *profile)
{
GConfClient *gconf_client;
MudPrefs *prefs;
GdkColor color;
GdkColor *colors;
gint n_colors;
struct stat file_stat;
gchar dirname[256], buf[256];
gchar *p;
gchar *p = NULL;
gchar extra_path[512] = "", keyname[2048];
gconf_client = gconf_client_get_default();
prefs = profile->preferences;
if (strcmp(profile->name, "Default"))
{
GError *error = NULL;
/* Sanity check for whether profile has data or not */
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/functionality/terminal_type", profile->name);
p = gconf_client_get_string(gconf_client, keyname, &error);
if (error || p == NULL)
{
g_message("Error getting data for profile %s, using default instead.", profile->name);
mud_profile_copy_preferences(mud_profile_new("Default"), profile);
}
else
{
g_snprintf(extra_path, 512, "profiles/%s/", profile->name);
}
}
/*
* Check for ~/.gnome-mud
......@@ -44,17 +69,21 @@ void gm_gconf_load_preferences(GConfClient *gconf_client, MudPrefs *prefs)
}
#define GCONF_GET_STRING(entry, subdir, variable) \
p = gconf_client_get_string(gconf_client, "/apps/gnome-mud/" #subdir "/" #entry, NULL);\
g_snprintf(keyname, 2048, "/apps/gnome-mud/%s" #subdir "/" #entry, extra_path); \
p = gconf_client_get_string(gconf_client, keyname, NULL);\
prefs->variable = g_strdup(p);
#define GCONF_GET_BOOLEAN(entry, subdir, variable) \
prefs->variable = gconf_client_get_bool(gconf_client, "/apps/gnome-mud/" #subdir "/" #entry, NULL);
g_snprintf(keyname, 2048, "/apps/gnome-mud/%s" #subdir "/" #entry, extra_path); \
prefs->variable = gconf_client_get_bool(gconf_client, keyname, NULL);
#define GCONF_GET_INT(entry, subdir, variable) \
prefs->variable = gconf_client_get_int(gconf_client, "/apps/gnome-mud/" #subdir "/" #entry, NULL);
g_snprintf(keyname, 2048, "/apps/gnome-mud/%s" #subdir "/" #entry, extra_path); \
prefs->variable = gconf_client_get_int(gconf_client, keyname, NULL);
#define GCONF_GET_COLOR(entry, subdir, variable) \
p = gconf_client_get_string(gconf_client, "/apps/gnome-mud/" #subdir "/" #entry, NULL);\
g_snprintf(keyname, 2048, "/apps/gnome-mud/%s" #subdir "/" #entry, extra_path); \
p = gconf_client_get_string(gconf_client, keyname, NULL);\
if (p && gdk_color_parse(p, &color)) \
{ \
prefs->variable = color; \
......@@ -76,7 +105,8 @@ void gm_gconf_load_preferences(GConfClient *gconf_client, MudPrefs *prefs)
GCONF_GET_INT(flush_interval, functionality, FlushInterval);
/* palette */
p = gconf_client_get_string(gconf_client, "/apps/gnome-mud/ui/palette", NULL);
g_snprintf(keyname, 2048, "/apps/gnome-mud/%sui/palette", extra_path);
p = gconf_client_get_string(gconf_client, keyname, NULL);
if (p)
{
......@@ -93,9 +123,10 @@ void gm_gconf_load_preferences(GConfClient *gconf_client, MudPrefs *prefs)
}
/* last log dir */
p = gconf_client_get_string(gconf_client, "/apps/gnome-mud/functionality/last_log_dir", NULL);
g_snprintf(keyname, 2048, "/apps/gnome-mud/%sfunctionality/last_log_dir", extra_path);
p = gconf_client_get_string(gconf_client, keyname, NULL);
if (!g_ascii_strncasecmp(p, "", sizeof("")))
if (p == NULL || !g_ascii_strncasecmp(p, "", sizeof("")))
{
prefs->LastLogDir = g_strdup(g_get_home_dir());
}
......
......@@ -2,4 +2,4 @@
#include "mud-profile.h"
void gm_gconf_load_preferences(GConfClient *gconf_client, MudPrefs *prefs);
void gm_gconf_load_preferences(MudProfile *profile);
......@@ -30,6 +30,7 @@
#include "gnome-mud.h"
#include "mud-window.h"
#include "mud-profile.h"
static char const rcsid[] =
"$Id$";
......@@ -107,10 +108,7 @@ int main (gint argc, char *argv[])
gnome_window_icon_set_default_from_file (PIXMAPSDIR "/gnome-mud.png");
//load_prefs (); /* load preferences */
//load_profiles(); /* load connections and profiles */
//main_window ();
mud_profile_load_profiles();
mud_window_new(gconf_client);
#ifdef USE_PYTHON
......
......@@ -2,13 +2,13 @@
# include "config.h"
#endif
#include <gconf/gconf-client.h>
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtkmenu.h>
#include <vte/vte.h>
#include "mud-connection-view.h"
#include "mud-preferences.h"
#include "mud-profile.h"
static char const rcsid[] = "$Id: ";
......@@ -20,7 +20,6 @@ struct _MudConnectionViewPrivate
GtkWidget *box;
GtkWidget *popup_menu;
MudPreferences *prefs;
MudProfile *profile;
gulong signal;
......@@ -35,7 +34,7 @@ static void mud_connection_view_set_terminal_scrollback (MudConnectionView *vie
static void mud_connection_view_set_terminal_scrolloutput(MudConnectionView *view);
static void mud_connection_view_set_terminal_font (MudConnectionView *view);
static void mud_connection_view_set_terminal_type (MudConnectionView *view);
static void mud_connection_view_prefs_changed_cb (MudPreferences *prefs, MudPreferenceMask *mask, MudConnectionView *view);
static void mud_connection_view_profile_changed_cb (MudProfile *profile, MudProfileMask *mask, MudConnectionView *view);
static gboolean mud_connection_view_button_press_event (GtkWidget *widget, GdkEventButton *event, MudConnectionView *view);
static void mud_connection_view_popup (MudConnectionView *view, GdkEventButton *event);
static void mud_connection_view_set_profile (MudConnectionView *view, MudProfile *profile);
......@@ -273,12 +272,12 @@ mud_connection_view_init (MudConnectionView *connection_view)
{
GtkWidget *box;
connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
connection_view->priv->prefs = mud_preferences_new(NULL);
//FIXME connection_view->priv->prefs = mud_preferences_new(NULL);
connection_view->priv->signal =
g_signal_connect(G_OBJECT(connection_view->priv->prefs),
g_signal_connect(G_OBJECT(connection_view->priv->profile),
"changed",
G_CALLBACK(mud_connection_view_prefs_changed_cb),
G_CALLBACK(mud_connection_view_profile_changed_cb),
connection_view);
box = gtk_hbox_new(FALSE, 0);
......@@ -422,53 +421,62 @@ mud_connection_view_reconnect(MudConnectionView *view)
void
mud_connection_view_send(MudConnectionView *view, const gchar *data)
{
GList *commands, *command;
gchar *text;
text = g_strdup_printf("%s\r\n", data);
gnetwork_connection_send(GNETWORK_CONNECTION(view->connection), text, strlen(text));
mud_connection_view_add_text(view, text, Sent);
g_free(text);
commands = mud_profile_process_commands(view->priv->profile, data);
for (command = g_list_first(commands); command != NULL; command = command->next)
{
text = g_strdup_printf("%s\r\n", (gchar *) command->data);
gnetwork_connection_send(GNETWORK_CONNECTION(view->connection), text, strlen(text));
if (view->priv->profile->preferences->EchoText)
mud_connection_view_add_text(view, text, Sent);
g_free(text);
}
g_list_free(commands);
}
static void
mud_connection_view_set_terminal_colors(MudConnectionView *view)
{
vte_terminal_set_colors(VTE_TERMINAL(view->priv->terminal),
&view->priv->prefs->preferences.Foreground,
&view->priv->prefs->preferences.Background,
view->priv->prefs->preferences.Colors, C_MAX);
&view->priv->profile->preferences->Foreground,
&view->priv->profile->preferences->Background,
view->priv->profile->preferences->Colors, C_MAX);
}
static void
mud_connection_view_set_terminal_scrollback(MudConnectionView *view)
{
vte_terminal_set_scrollback_lines(VTE_TERMINAL(view->priv->terminal),
view->priv->prefs->preferences.Scrollback);
view->priv->profile->preferences->Scrollback);
}
static void
mud_connection_view_set_terminal_scrolloutput(MudConnectionView *view)
{
vte_terminal_set_scroll_on_output(VTE_TERMINAL(view->priv->terminal),
view->priv->prefs->preferences.ScrollOnOutput);
view->priv->profile->preferences->ScrollOnOutput);
}
static void
mud_connection_view_set_terminal_font(MudConnectionView *view)
{
vte_terminal_set_font_from_string(VTE_TERMINAL(view->priv->terminal),
view->priv->prefs->preferences.FontName);
view->priv->profile->preferences->FontName);
}
static void
mud_connection_view_set_terminal_type(MudConnectionView *view)
{
vte_terminal_set_emulation(VTE_TERMINAL(view->priv->terminal),
view->priv->prefs->preferences.TerminalType);
view->priv->profile->preferences->TerminalType);
}
static void
mud_connection_view_prefs_changed_cb(MudPreferences *prefs, MudPreferenceMask *mask, MudConnectionView *view)
mud_connection_view_profile_changed_cb(MudProfile *profile, MudProfileMask *mask, MudConnectionView *view)
{
if (mask->ScrollOnOutput)
mud_connection_view_set_terminal_scrolloutput(view);
......@@ -541,7 +549,7 @@ mud_connection_view_popup(MudConnectionView *view, GdkEventButton *event)
gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
group = NULL;
profiles = mud_preferences_get_profiles(view->priv->prefs);
profiles = mud_profile_get_profiles();
profile = profiles;
while (profile != NULL)
{
......@@ -595,7 +603,7 @@ mud_connection_view_popup(MudConnectionView *view, GdkEventButton *event)
}
MudConnectionView*
mud_connection_view_new (const gchar *hostname, const gint port)
mud_connection_view_new (const gchar *profile, const gchar *hostname, const gint port)
{
MudConnectionView *view;
......@@ -613,6 +621,8 @@ mud_connection_view_new (const gchar *hostname, const gint port)
g_signal_connect(view->connection, "sent", G_CALLBACK(mud_connection_view_send_cb), view);
g_signal_connect(view->connection, "error", G_CALLBACK(mud_connection_view_error_cb), view);
g_signal_connect(view->connection, "notify::tcp-status", G_CALLBACK(mud_connection_view_notify_cb), view);
mud_connection_view_set_profile(view, mud_profile_new(profile));
// FIXME, move this away from here
gnetwork_connection_open(GNETWORK_CONNECTION(view->connection));
......@@ -626,18 +636,18 @@ mud_connection_view_set_profile(MudConnectionView *view, MudProfile *profile)
if (profile == view->priv->profile)
return;
if (profile)
{
g_object_ref(G_OBJECT(profile));
//view->priv->signal_profile_changed =
}
if (view->priv->profile)
{
g_signal_handler_disconnect(view->priv->profile, view->priv->signal_profile_changed);
g_object_unref(G_OBJECT(view->priv->profile));
}
view->priv->profile = profile;
g_object_ref(G_OBJECT(profile));
view->priv->signal_profile_changed =
g_signal_connect(G_OBJECT(view->priv->profile), "changed",
G_CALLBACK(mud_connection_view_profile_changed_cb),
view);
mud_connection_view_reread_profile(view);
}
......
......@@ -41,7 +41,7 @@ enum MudConnectionColorType
GType mud_connection_view_get_type (void) G_GNUC_CONST;
MudConnectionView* mud_connection_view_new (const gchar *hostname, const gint port);
MudConnectionView* mud_connection_view_new (const gchar *profile, const gchar *hostname, const gint port);
GtkWidget* mud_connection_view_get_viewport (MudConnectionView *view);
void mud_connection_view_disconnect (MudConnectionView *view);
void mud_connection_view_reconnect (MudConnectionView *view);
......
......@@ -18,6 +18,7 @@
#include <glib/gi18n.h>
#include <libgnomeui/gnome-color-picker.h>
#include <libgnomeui/gnome-font-picker.h>
#include <string.h>
#include "mud-preferences-window.h"
#include "mud-profile.h"
......@@ -26,7 +27,7 @@ static char const rcsid[] = "$Id: ";
struct _MudPreferencesWindowPrivate
{
MudPreferences *prefs;
MudProfile *profile;
GtkWidget *treeview;
GtkWidget *notebook;
......@@ -49,6 +50,8 @@ struct _MudPreferencesWindowPrivate
GtkWidget *colors[C_MAX];
gulong signal;
gint notification_count;
};
enum
......@@ -62,13 +65,15 @@ enum
enum
{
COLUMN_NODE,
COLUMN_PREFERENCES
COLUMN_PREFERENCES,
COLUMN_ALIASES
};
enum
{
TAB_BLANK,
TAB_PREFERENCES
TAB_PREFERENCES,
TAB_ALIASES
};
static void mud_preferences_window_init (MudPreferencesWindow *preferences);
......@@ -76,7 +81,10 @@ static void mud_preferences_window_class_init (MudPreferencesWindowClass
static void mud_preferences_window_finalize (GObject *object);
static void mud_preferences_window_tree_selection_cb (GtkTreeSelection *selection, MudPreferencesWindow *window);
static void mud_preferences_window_show_tab (MudPreferencesWindow *window, gint tab);
static void mud_preferences_window_connect_callbacks (MudPreferencesWindow *window);
static gboolean mud_preferences_window_response_cb (GtkWidget *dialog, GdkEvent *Event, MudPreferencesWindow *window);
static void mud_preferences_window_change_profile_from_name (MudPreferencesWindow *window, const gchar *profile);
static void mud_preferences_window_change_profile (MudPreferencesWindow *window, MudProfile *profile);
static void mud_preferences_window_set_preferences (MudPreferencesWindow *window);
static void mud_preferences_window_echo_cb (GtkWidget *widget, MudPreferencesWindow *window);
......@@ -92,7 +100,7 @@ static void mud_preferences_window_foreground_cb (GtkWidget *widget, guint
static void mud_preferences_window_background_cb (GtkWidget *widget, guint r, guint g, guint b, guint a, MudPreferencesWindow *window);
static void mud_preferences_window_colors_cb (GtkWidget *widget, guint r, guint g, guint b, guint a, MudPreferencesWindow *window);
static void mud_preferences_window_changed_cb (MudPreferences *prefs, MudPreferenceMask *mask, MudPreferencesWindow *window);
static void mud_preferences_window_changed_cb (MudProfile *profile, MudProfileMask *mask, MudPreferencesWindow *window);
static void mud_preferences_window_update_echotext (MudPreferencesWindow *window, MudPrefs *preferences);
static void mud_preferences_window_update_keeptext (MudPreferencesWindow *window, MudPrefs *preferences);
......@@ -107,6 +115,8 @@ static void mud_preferences_window_update_foreground (MudPreferencesWindow *win
static void mud_preferences_window_update_background (MudPreferencesWindow *window, MudPrefs *preferences);
static void mud_preferences_window_update_colors (MudPreferencesWindow *window, MudPrefs *preferences);
#define RETURN_IF_CHANGING_PROFILES(window) if (window->priv->notification_count) return
GType
mud_preferences_window_get_type (void)
{
......@@ -143,6 +153,8 @@ mud_preferences_window_init (MudPreferencesWindow *preferences)
gint i;
preferences->priv = g_new0(MudPreferencesWindowPrivate, 1);
preferences->priv->profile = NULL;
preferences->priv->notification_count = 0;
glade = glade_xml_new(GLADEDIR "main.glade", "preferences_window", "preferences_window");
dialog = glade_xml_get_widget(glade, "preferences_window");
......@@ -182,6 +194,7 @@ mud_preferences_window_init (MudPreferencesWindow *preferences)
g_signal_connect(G_OBJECT(dialog), "response",
G_CALLBACK(mud_preferences_window_response_cb), preferences);
mud_preferences_window_connect_callbacks(preferences);
g_object_unref(G_OBJECT(glade));
}
......@@ -201,7 +214,7 @@ mud_preferences_window_finalize (GObject *object)
GObjectClass *parent_class;
preferences = MUD_PREFERENCES_WINDOW(object);
g_signal_handler_disconnect(preferences->priv->prefs,
g_signal_handler_disconnect(preferences->priv->profile,
preferences->priv->signal);
g_free(preferences->priv);
......@@ -238,13 +251,23 @@ mud_preferences_window_fill_profiles (MudPreferencesWindow *window)
DATA_COLUMN, NULL,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_PREFERENCES),
-1);
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
TITLE_COLUMN, _("Aliases"),
DATA_COLUMN, NULL,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_ALIASES),
-1);
list = mud_preferences_get_profiles(window->priv->prefs);
list = mud_profile_get_profiles();
for (entry = (GList *) list; entry != NULL; entry = g_list_next(entry))
{
GtkTreeIter iter_child;
MudProfile *profile = (MudProfile *) entry->data;
/* Special hack for default profile */
if (!strcmp(profile->name, "Default")) continue;
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
TITLE_COLUMN, profile->name,
......@@ -257,6 +280,12 @@ mud_preferences_window_fill_profiles (MudPreferencesWindow *window)
DATA_COLUMN, profile,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_PREFERENCES),
-1);
gtk_tree_store_append(store, &iter_child, &iter);
gtk_tree_store_set(store, &iter_child,
TITLE_COLUMN, _("Aliases"),
DATA_COLUMN, profile,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_ALIASES),
-1);
}
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(window->priv->treeview));
......@@ -295,7 +324,18 @@ mud_preferences_window_tree_selection_cb(GtkTreeSelection *selection, MudPrefere
gtk_tree_model_get(model, &iter, DATA_COLUMN, &profile, TYPE_COLUMN, &type, -1);
mud_preferences_window_show_tab(window, TAB_PREFERENCES);
if (profile == NULL)
{
mud_preferences_window_change_profile_from_name(window, "Default");
}
else
{
mud_preferences_window_change_profile(window, profile);
}
window->priv->notification_count++;
mud_preferences_window_show_tab(window, type);
window->priv->notification_count--;
}
}
......@@ -308,7 +348,7 @@ mud_preferences_window_show_tab(MudPreferencesWindow *window, gint tab)
switch (tab)
{
case COLUMN_PREFERENCES:
widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->priv->notebook), COLUMN_PREFERENCES);
widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(window->priv->notebook), tab);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widget), 0);
mud_preferences_window_set_preferences(window);
break;
......@@ -325,157 +365,187 @@ mud_preferences_window_response_cb(GtkWidget *dialog, GdkEvent *event, MudPrefer
}
static void
mud_preferences_window_set_preferences(MudPreferencesWindow *window)
mud_preferences_window_change_profile_from_name(MudPreferencesWindow *window, const gchar *name)
{
MudProfile *profile;
profile = mud_profile_new(name);
mud_preferences_window_change_profile(window, profile);
}
static void
mud_preferences_window_change_profile(MudPreferencesWindow *window, MudProfile *profile)
{
g_message("changing prefs profile to %s", profile->name);
if (window->priv->profile != NULL)
{
g_signal_handler_disconnect(window->priv->profile, window->priv->signal);
g_object_unref(window->priv->profile);
}
window->priv->profile = profile;
window->priv->signal = g_signal_connect(G_OBJECT(window->priv->profile), "changed",
G_CALLBACK(mud_preferences_window_changed_cb),
window);
g_object_ref(G_OBJECT(window->priv->profile));
}
static void
mud_preferences_window_connect_callbacks(MudPreferencesWindow *window)
{
gint i;
MudPreferences *prefs = window->priv->prefs;
mud_preferences_window_update_echotext(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cb_echo), "toggled",
G_CALLBACK(mud_preferences_window_echo_cb),
window);
mud_preferences_window_update_keeptext(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cb_keep), "toggled",
G_CALLBACK(mud_preferences_window_keeptext_cb),
window);
mud_preferences_window_update_disablekeys(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cb_disable), "toggled",
G_CALLBACK(mud_preferences_window_disablekeys_cb),
window);
mud_preferences_window_update_scrolloutput(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cb_scrollback), "toggled",
G_CALLBACK(mud_preferences_window_scrolloutput_cb),
window);
mud_preferences_window_update_commdev(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->entry_commdev), "changed",
G_CALLBACK(mud_preferences_window_commdev_cb),
window);
mud_preferences_window_update_terminaltype(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->entry_terminal), "changed",
G_CALLBACK(mud_preferences_window_terminal_cb),
window);
mud_preferences_window_update_history(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->sb_history), "changed",
G_CALLBACK(mud_preferences_window_history_cb),
window);
mud_preferences_window_update_scrollback(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->sb_lines), "changed",
G_CALLBACK(mud_preferences_window_scrollback_cb),
window);
mud_preferences_window_update_font(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->fp_font), "font_set",
G_CALLBACK(mud_preferences_window_font_cb),
window);
mud_preferences_window_update_foreground(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cp_foreground), "color_set",
G_CALLBACK(mud_preferences_window_foreground_cb),
window);
mud_preferences_window_update_background(window, &prefs->preferences);
g_signal_connect(G_OBJECT(window->priv->cp_background), "color_set",
G_CALLBACK(mud_preferences_window_background_cb),
window);
mud_preferences_window_update_colors(window, &prefs->preferences);
for (i = 0; i < C_MAX; i++)
{
g_signal_connect(G_OBJECT(window->priv->colors[i]), "color_set",
G_CALLBACK(mud_preferences_window_colors_cb),
window);
}
#undef SET_SPIN_BUTTON
}
static void
mud_preferences_window_set_preferences(MudPreferencesWindow *window)
{
MudProfile *profile = window->priv->profile;
mud_preferences_window_update_echotext(window, profile->preferences);
mud_preferences_window_update_keeptext(window, profile->preferences);
mud_preferences_window_update_disablekeys(window, profile->preferences);
mud_preferences_window_update_scrolloutput(window, profile->preferences);
mud_preferences_window_update_commdev(window, profile->preferences);
mud_preferences_window_update_terminaltype(window, profile->preferences);
mud_preferences_window_update_history(window, profile->preferences);
mud_preferences_window_update_scrollback(window, profile->preferences);
mud_preferences_window_update_font(window, profile->preferences);
mud_preferences_window_update_foreground(window, profile->preferences);
mud_preferences_window_update_background(window, profile->preferences);
mud_preferences_window_update_colors(window, profile->preferences);
}
static void
mud_preferences_window_disablekeys_cb(GtkWidget *widget, MudPreferencesWindow *window)
{
gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
RETURN_IF_CHANGING_PROFILES(window);
mud_preferences_set_disablekeys(window->priv->prefs, value);