gnome-mud r674 - in trunk: . src
- From: lharris svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-mud r674 - in trunk: . src
- Date: Sat, 28 Jun 2008 05:02:33 +0000 (UTC)
Author: lharris
Date: Sat Jun 28 05:02:32 2008
New Revision: 674
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=674&view=rev
Log:
Added auto-focus to text entry, added schemas for new prefs, removed trailing whitespace.
Modified:
trunk/ChangeLog
trunk/gnome-mud.schemas.in
trunk/src/gconf-helper.c
trunk/src/gnome-mud.c
trunk/src/modules.c
trunk/src/modules_api.c
trunk/src/mud-connection-view.c
trunk/src/mud-connection-view.h
trunk/src/mud-log.c
trunk/src/mud-parse-alias.c
trunk/src/mud-parse-alias.h
trunk/src/mud-parse-base.c
trunk/src/mud-parse-base.h
trunk/src/mud-parse-trigger.c
trunk/src/mud-parse-trigger.h
trunk/src/mud-preferences-window.c
trunk/src/mud-profile.c
trunk/src/mud-profile.h
trunk/src/mud-regex.c
trunk/src/mud-regex.h
trunk/src/mud-telnet-handlers.c
trunk/src/mud-telnet-handlers.h
trunk/src/mud-telnet-zmp.c
trunk/src/mud-telnet-zmp.h
trunk/src/mud-telnet.c
trunk/src/mud-telnet.h
trunk/src/mud-window-mconnect.c
trunk/src/mud-window-mconnect.h
trunk/src/mud-window-mudedit.c
trunk/src/mud-window-mudedit.h
trunk/src/mud-window-mudlist.c
trunk/src/mud-window-profile.c
trunk/src/mud-window.c
trunk/src/utils.c
Modified: trunk/gnome-mud.schemas.in
==============================================================================
--- trunk/gnome-mud.schemas.in (original)
+++ trunk/gnome-mud.schemas.in Sat Jun 28 05:02:32 2008
@@ -101,6 +101,90 @@
<!-- functionality settings -->
<schema>
+ <key>/schemas/apps/gnome-mud/functionality/encoding</key>
+ <applyto>/apps/gnome-mud/functionality/encoding</applyto>
+ <owner>gnome-mud</owner>
+ <type>string</type>
+ <default>ISO-8859-1</default>
+ <locale name="C">
+ <short>Encoding</short>
+ <long>
+ The encoding for the terminal widget.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-mud/functionality/encoding_index</key>
+ <applyto>/apps/gnome-mud/functionality/encoding_index</applyto>
+ <owner>gnome-mud</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Encoding Index</short>
+ <long>
+ The index of the currently selected encoding.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-mud/functionality/proxy_hostname</key>
+ <applyto>/apps/gnome-mud/functionality/proxy_hostname</applyto>
+ <owner>gnome-mud</owner>
+ <type>string</type>
+ <default>127.0.0.1</default>
+ <locale name="C">
+ <short>Proxy Hostname</short>
+ <long>
+ The hostname for the SOCKS proxy server.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-mud/functionality/proxy_version</key>
+ <applyto>/apps/gnome-mud/functionality/proxy_version</applyto>
+ <owner>gnome-mud</owner>
+ <type>string</type>
+ <default>5</default>
+ <locale name="C">
+ <short>Proxy Version</short>
+ <long>
+ The SOCKS Version to be used.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-mud/functionality/remote_encoding</key>
+ <applyto>/apps/gnome-mud/functionality/remote_encoding</applyto>
+ <owner>gnome-mud</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Remote Encoding</short>
+ <long>
+ Use Remote Encoding charset negotiation.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnome-mud/functionality/use_proxy</key>
+ <applyto>/apps/gnome-mud/functionality/use_proxy</applyto>
+ <owner>gnome-mud</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use Proxy</short>
+ <long>
+ Use a proxy server to connect to the mud.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome-mud/functionality/commdev</key>
<applyto>/apps/gnome-mud/functionality/commdev</applyto>
<owner>gnome-mud</owner>
Modified: trunk/src/gconf-helper.c
==============================================================================
--- trunk/src/gconf-helper.c (original)
+++ trunk/src/gconf-helper.c Sat Jun 28 05:02:32 2008
@@ -40,14 +40,14 @@
gchar dirname[256], buf[256];
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);
@@ -57,12 +57,12 @@
mud_profile_copy_preferences(mud_profile_new("Default"), profile);
}
else
- {
+ {
g_snprintf(extra_path, 512, "profiles/%s/", profile->name);
}
}
-
+
/*
* Check for ~/.gnome-mud
*/
@@ -75,7 +75,7 @@
//popup_window (buf); FIXME
return;
}
- }
+ }
else /* it must not exist */
{
if ((mkdir (dirname, 0777)) != 0) /* this isn't dangerous, umask modifies it */
@@ -98,7 +98,7 @@
#define GCONF_GET_INT(entry, subdir, variable) \
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) \
g_snprintf(keyname, 2048, "/apps/gnome-mud/%s" #subdir "/" #entry, extra_path); \
p = gconf_client_get_string(gconf_client, keyname, NULL);\
@@ -107,7 +107,7 @@
prefs->variable = color; \
}
- GCONF_GET_STRING(font, ui, FontName);
+ GCONF_GET_STRING(font, ui, FontName);
GCONF_GET_COLOR(foreground_color, ui, Foreground);
GCONF_GET_COLOR(background_color, ui, Background);
GCONF_GET_INT(scrollback_lines, ui, Scrollback);
@@ -126,7 +126,7 @@
GCONF_GET_BOOLEAN(use_proxy, functionality, UseProxy);
GCONF_GET_BOOLEAN(remote_encoding, functionality, UseRemoteEncoding);
GCONF_GET_STRING(proxy_hostname, functionality, ProxyHostname);
-
+
/* palette */
g_snprintf(keyname, 2048, "/apps/gnome-mud/%sui/palette", extra_path);
p = gconf_client_get_string(gconf_client, keyname, NULL);
@@ -138,7 +138,7 @@
{
g_printerr(ngettext("Palette had %d entry instead of %d\n",
"Palette had %d entries instead of %d\n",
- n_colors),
+ n_colors),
n_colors, C_MAX);
}
memcpy(prefs->Colors, colors, C_MAX * sizeof(GdkColor));
@@ -168,7 +168,7 @@
gchar** unusual_exits;
unusual_exits = g_malloc0(sizeof(char) * (strlen(p) + 2));
unusual_exits = g_strsplit(p, ";", 100);
-
+
for (i = 0; unusual_exits[i] != NULL; i++)
{
unusual_exits[i] = g_strstrip(unusual_exits[i]);
Modified: trunk/src/gnome-mud.c
==============================================================================
--- trunk/src/gnome-mud.c (original)
+++ trunk/src/gnome-mud.c Sat Jun 28 05:02:32 2008
@@ -44,7 +44,7 @@
{
gchar *string;
GError *error = NULL;
-
+
string = gconf_client_get_string (client, key, &error);
if (error) {
@@ -101,9 +101,9 @@
/* Initialize the Gnet library */
gnet_init();
-
+
gtk_init(&argc, &argv);
-
+
/* Start a GConf client */
gconf_client = gconf_client_get_default();
if (!gconf_sanity_check_string (gconf_client, "/apps/gnome-mud/functionality/terminal_type")) {
@@ -113,10 +113,10 @@
mud_profile_load_profiles();
-
- gtk_window_set_icon_from_file(GTK_WINDOW(mud_window_get_window(mud_window_new(gconf_client))),
+
+ gtk_window_set_icon_from_file(GTK_WINDOW(mud_window_get_window(mud_window_new(gconf_client))),
PIXMAPSDIR "/gnome-mud.png", &err);
-
+
#ifdef USE_PYTHON
//Py_SetProgramName(argv[0]);
//Py_Initialize();
@@ -130,12 +130,12 @@
init_modules(buf);
init_modules(PKGDATADIR);
-
+
g_snprintf(buf, 500, "%s/.gnome-mud/logs/", g_get_home_dir());
if(!g_file_test(buf, G_FILE_TEST_IS_DIR))
- mkdir(buf, 0777 );
+ mkdir(buf, 0777 );
- gtk_about_dialog_set_url_hook(utils_activate_url, NULL, NULL);
+ gtk_about_dialog_set_url_hook(utils_activate_url, NULL, NULL);
gtk_main();
gconf_client_suggest_sync(gconf_client, &err);
Modified: trunk/src/modules.c
==============================================================================
--- trunk/src/modules.c (original)
+++ trunk/src/modules.c Sat Jun 28 05:02:32 2008
@@ -17,7 +17,7 @@
*/
/*
-** This module/plug-in API is slighly based on the API in gEdit.
+** This module/plug-in API is slighly based on the API in gEdit.
*/
#ifndef __MODULES_C__
@@ -68,7 +68,7 @@
GList *t;
for (t = g_list_first(Plugin_list); t != NULL; t = t->next) {
-
+
if (t->data != NULL) {
p = (PLUGIN_OBJECT *) t->data;
@@ -90,14 +90,14 @@
if (t->data != NULL)
{
p = (PLUGIN_OBJECT *) t->data;
-
+
if (!strcmp (p->info->plugin_name, name))
{
return p;
}
}
}
-
+
return NULL;
}
@@ -109,7 +109,7 @@
GError *err = NULL;
client = gconf_client_get_default();
-
+
gtk_clist_get_text ((GtkCList *) data, plugin_selected_row, 0, &text);
p = plugin_get_plugin_object_by_name (text);
@@ -124,7 +124,7 @@
}
g_snprintf(path, 128, "/apps/gnome-mud/Plugins/%s/enbl", p->name);
- gconf_client_set_bool(client, path, p->enabled, &err);
+ gconf_client_set_bool(client, path, p->enabled, &err);
}
}
@@ -142,14 +142,14 @@
{
GtkTextBuffer *buffer;
GtkWidget *plugin_desc_text = gtk_object_get_data(GTK_OBJECT(clist), "plugin_desc_text");
-
+
gtk_entry_set_text (GTK_ENTRY (gtk_object_get_data(GTK_OBJECT(clist), "plugin_name_entry")), p->info->plugin_name);
gtk_entry_set_text (GTK_ENTRY (gtk_object_get_data(GTK_OBJECT(clist), "plugin_author_entry")), p->info->plugin_author);
gtk_entry_set_text (GTK_ENTRY (gtk_object_get_data(GTK_OBJECT(clist), "plugin_version_entry")), p->info->plugin_version);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugin_desc_text));
gtk_text_buffer_set_text(buffer, p->info->plugin_descr, -1);
-
+
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(clist), "plugin_enable_check")), p->enabled);
}
}
@@ -187,7 +187,7 @@
GtkWidget *plugin_version_entry;
GtkWidget *plugin_desc_text;
GtkWidget *plugin_enable_check;
-
+
if (dialog1 != NULL) {
gtk_window_present (GTK_WINDOW (dialog1));
return;
@@ -196,7 +196,7 @@
dialog1 = gtk_dialog_new();
gtk_object_set_data (GTK_OBJECT (dialog1), "dialog1", dialog1);
gtk_widget_set_usize (dialog1, 430, -2);
-
+
gtk_window_set_title(GTK_WINDOW(dialog1), _("Plugin Information"));
gtk_window_set_policy (GTK_WINDOW (dialog1), FALSE, FALSE, FALSE);
@@ -362,11 +362,11 @@
gtk_object_set_data(GTK_OBJECT(clist1), "plugin_author_entry", plugin_author_entry);
gtk_object_set_data(GTK_OBJECT(clist1), "plugin_version_entry", plugin_version_entry);
gtk_object_set_data(GTK_OBJECT(clist1), "plugin_desc_text", plugin_desc_text);
- gtk_object_set_data(GTK_OBJECT(clist1), "plugin_enable_check", plugin_enable_check);
+ gtk_object_set_data(GTK_OBJECT(clist1), "plugin_enable_check", plugin_enable_check);
g_list_foreach (Plugin_list, (GFunc) plugin_clist_append, clist1);
gtk_clist_select_row (GTK_CLIST (clist1), 0, 0);
-
+
gtk_widget_show(dialog1);
}
@@ -380,32 +380,32 @@
g_message(_("Plugin error (%s)"), path);
return FALSE;
}
-
+
while ((direntity = readdir(directory))) {
PLUGIN_OBJECT *plugin;
gchar *suffix;
-
+
if (strrchr(direntity->d_name, '/'))
shortname = (gchar *) strrchr(direntity->d_name, '/') + 1;
else
shortname = direntity->d_name;
-
+
if (!strcmp(shortname, ".") || !strcmp(shortname, ".."))
continue;
-
+
suffix = (gchar *) strrchr(direntity->d_name, '.');
if (!suffix || strcmp(suffix, ".plugin"))
continue;
-
+
plugin = plugin_query(direntity->d_name, path);
if (!plugin)
continue;
-
+
plugin_register(plugin);
}
-
+
closedir(directory);
-
+
return TRUE;
}
@@ -416,9 +416,9 @@
new_plugin->name = g_strdup(plugin_name);
sprintf (filename, "%s%s", plugin_path, plugin_name);
-
+
new_plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY);
-
+
if(new_plugin == NULL)
{
g_message (_("Error getting plugin handle (%s): %s."), plugin_name, g_module_error());
@@ -426,7 +426,7 @@
} else {
void *data = &new_plugin->info;
gpointer *info = (gpointer *)data;
-
+
if(!g_module_symbol(new_plugin->handle, "gnomemud_plugin_info", info))
{
g_message (_("Error, %s not an GNOME-Mud module: %s."), plugin_name, g_module_error());
@@ -462,7 +462,7 @@
plugin_check_enable(plugin);
Plugin_list = g_list_append(Plugin_list, (gpointer) plugin);
-
+
if (plugin->info->init_function) {
plugin->info->init_function(NULL, plugin->handle);
}
@@ -470,14 +470,14 @@
void popup_message(const gchar *data)
{
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, data);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
-void
+void
init_modules_win(MudWindow *win)
{
gGMudWindow = win;
Modified: trunk/src/modules_api.c
==============================================================================
--- trunk/src/modules_api.c (original)
+++ trunk/src/modules_api.c Sat Jun 28 05:02:32 2008
@@ -63,20 +63,20 @@
/* Stupid hack for gmodule */
temp = (void *)&sig_function;
sigptr = (gpointer *)temp;
-
+
if (!g_module_symbol(handle, function, sigptr))
{
g_message (_("Error while registering the menu: %s"), g_module_error());
return FALSE;
}
-
+
newMenuItem = gtk_menu_item_new_with_label(name);
gtk_widget_show(newMenuItem);
-
+
gtk_menu_shell_prepend(GTK_MENU_SHELL(pluginMenu), newMenuItem);
gtk_signal_connect(GTK_OBJECT(newMenuItem), "activate", sig_function, NULL);
-
+
return TRUE;
}
@@ -90,7 +90,7 @@
/* Stupid hack for Gmodule */
temp = (void *)&datafunc;
dataptr = (gpointer *)temp;
-
+
if (!g_module_symbol(handle, function, dataptr))
{
g_message (_("Error while registering data %s: %s"), dir == PLUGIN_DATA_IN ? "incoming" : "outgoing",
@@ -109,7 +109,7 @@
Plugin_data_list = g_list_append(Plugin_data_list, (gpointer) data);
PluginGag = FALSE;
-
+
return TRUE;
}
Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c (original)
+++ trunk/src/mud-connection-view.c Sat Jun 28 05:02:32 2008
@@ -46,10 +46,10 @@
struct _MudConnectionViewPrivate
{
gint id;
-
+
MudWindow *window;
MudTray *tray;
-
+
GtkWidget *terminal;
GtkWidget *scrollbar;
GtkWidget *box;
@@ -66,10 +66,10 @@
gchar *connect_string;
MudParseBase *parse;
-
+
GQueue *history;
guint current_history_index;
-
+
MudTelnet *telnet;
gchar *hostname;
guint port;
@@ -125,7 +125,7 @@
GConfClient *client;
GError *error;
gboolean use_image;
-
+
menu_item = gtk_image_menu_item_new_from_stock(text, NULL);
image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(menu_item));
@@ -239,7 +239,7 @@
g_stpcpy(buf, message);
mud_connection_view_str_replace(buf, "\r", "");
mud_connection_view_str_replace(buf, "\n", "\n\r");
-
+
vte_terminal_feed(VTE_TERMINAL(view->priv->terminal), buf, strlen(buf));
}
@@ -250,21 +250,21 @@
gchar *profile_name;
GConfClient *client;
gboolean remote;
-
+
gchar key[2048];
gchar extra_path[512] = "";
-
+
client = gconf_client_get_default();
-
+
g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/remote_encoding");
remote = gconf_client_get_bool(client, key, NULL);
-
+
if(view->remote_encode && remote)
encoding = view->remote_encoding;
else
{
profile_name = mud_profile_get_name(view->priv->profile);
-
+
if (strcmp(profile_name, "Default"))
{
g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
@@ -273,9 +273,9 @@
g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/encoding");
encoding = gconf_client_get_string(client, key, NULL);
}
-
+
vte_terminal_set_encoding(VTE_TERMINAL(view->priv->terminal), encoding);
-
+
switch (type)
{
case Sent:
@@ -300,26 +300,26 @@
mud_connection_view_feed_text(view, "\e[0m");
}
-
+
static void
mud_connection_view_init (MudConnectionView *connection_view)
{
GtkWidget *box;
-
+
connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
-
+
connection_view->priv->history = g_queue_new();
connection_view->priv->current_history_index = 0;
-
+
connection_view->priv->parse = mud_parse_base_new(connection_view);
-
+
connection_view->priv->connect_hook = FALSE;
-
+
box = gtk_hbox_new(FALSE, 0);
-
+
connection_view->priv->terminal = vte_terminal_new();
vte_terminal_set_encoding(VTE_TERMINAL(connection_view->priv->terminal), "ISO-8859-1");
-
+
gtk_box_pack_start(GTK_BOX(box), connection_view->priv->terminal, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(connection_view->priv->terminal),
"button_press_event",
@@ -331,10 +331,10 @@
connection_view->priv->scrollbar = gtk_vscrollbar_new(NULL);
gtk_range_set_adjustment(GTK_RANGE(connection_view->priv->scrollbar), VTE_TERMINAL(connection_view->priv->terminal)->adjustment);
gtk_box_pack_start(GTK_BOX(box), connection_view->priv->scrollbar, FALSE, FALSE, 0);
-
+
gtk_widget_show_all(box);
g_object_set_data(G_OBJECT(box), "connection-view", connection_view);
-
+
connection_view->priv->box = box;
connection_view->priv->connected = FALSE;
@@ -370,22 +370,22 @@
while((history_item = (gchar *)g_queue_pop_head(connection_view->priv->history)) != NULL)
if(history_item != NULL)
g_free(history_item);
-
+
if(connection_view->priv->history)
g_queue_free(connection_view->priv->history);
-
+
mud_zmp_finalize(connection_view->priv->telnet);
-
+
gnet_conn_disconnect(connection_view->connection);
gnet_conn_unref(connection_view->connection);
-
+
g_free(connection_view->priv);
-
+
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
parent_class->finalize(object);
}
-void
+void
mud_connection_view_set_connect_string(MudConnectionView *view, gchar *connect_string)
{
g_assert(view != NULL);
@@ -397,7 +397,7 @@
mud_connection_view_disconnect(MudConnectionView *view)
{
g_assert(view != NULL);
-
+
gnet_conn_disconnect(view->connection);
mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
}
@@ -406,16 +406,16 @@
mud_connection_view_reconnect(MudConnectionView *view)
{
gchar *buf;
-
+
g_assert(view != NULL);
-
+
gnet_conn_disconnect(view->connection);
mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
-
- buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
+
+ buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
view->priv->hostname, view->priv->port);
mud_connection_view_add_text(view, buf, System);
-
+
gnet_conn_connect(view->connection);
}
@@ -429,21 +429,21 @@
g_queue_push_head(view->priv->history, (gpointer)g_strdup(data));
else
g_queue_push_head(view->priv->history, (gpointer)g_strdup(" "));
-
+
view->priv->current_history_index = 0;
-
+
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);
-
+
// Give plugins first crack at it.
- mud_window_handle_plugins(view->priv->window, view->priv->id,
+ mud_window_handle_plugins(view->priv->window, view->priv->id,
(gchar *)text, strlen(text), 0);
-
+
gnet_conn_write(view->connection, text, strlen(text));
-
+
if (view->priv->profile->preferences->EchoText && view->local_echo)
mud_connection_view_add_text(view, text, Sent);
g_free(text);
@@ -461,19 +461,19 @@
view->priv->profile->preferences->Colors, C_MAX);
}
-void
+void
mud_connection_view_start_logging(MudConnectionView *view)
{
mud_log_open(view->priv->log);
}
-void
+void
mud_connection_view_stop_logging(MudConnectionView *view)
{
mud_log_close(view->priv->log);
}
-gboolean
+gboolean
mud_connection_view_islogging(MudConnectionView *view)
{
return mud_log_islogging(view->priv->log);
@@ -500,15 +500,15 @@
{
PangoFontDescription *desc = NULL;
char *name;
-
+
name = view->priv->profile->preferences->FontName;
-
+
if(name)
desc = pango_font_description_from_string(name);
-
+
if(!desc)
desc = pango_font_description_from_string("Monospace 10");
-
+
vte_terminal_set_font(VTE_TERMINAL(view->priv->terminal), desc);
}
@@ -556,7 +556,7 @@
const GList *profiles;
const GList *profile;
GSList *group;
-
+
if (view->priv->popup_menu)
gtk_widget_destroy(view->priv->popup_menu);
@@ -586,7 +586,7 @@
menu_item = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
+
profile_menu = gtk_menu_new();
menu_item = gtk_menu_item_new_with_mnemonic(_("Change P_rofile"));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), profile_menu);
@@ -611,7 +611,7 @@
if (prof == view->priv->profile)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), TRUE);
-
+
g_signal_connect(G_OBJECT(menu_item),
"toggled",
G_CALLBACK(choose_profile_callback),
@@ -625,7 +625,7 @@
menu_item = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
+
im_menu = gtk_menu_new();
menu_item = gtk_menu_item_new_with_mnemonic(_("_Input Methods"));
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), im_menu);
@@ -641,7 +641,7 @@
event ? event->time : gtk_get_current_event_time());
}
-void
+void
mud_connection_view_set_id(MudConnectionView *view, gint id)
{
view->priv->id = id;
@@ -659,13 +659,13 @@
{
gchar *profile_name;
GConfClient *client;
-
+
gchar key[2048];
gchar extra_path[512] = "";
gboolean use_proxy;
gchar *proxy_host;
gchar *version;
-
+
MudConnectionView *view;
GdkGeometry hints;
gint xpad, ypad;
@@ -674,30 +674,30 @@
g_assert(hostname != NULL);
g_assert(port > 0);
-
+
view = g_object_new(MUD_TYPE_CONNECTION_VIEW, NULL);
-
+
view->priv->hostname = g_strdup(hostname);
view->priv->port = port;
-
- view->connection = gnet_conn_new(hostname, port,
+
+ view->connection = gnet_conn_new(hostname, port,
mud_connection_view_network_event_cb, view);
gnet_conn_ref(view->connection);
gnet_conn_set_watch_error(view->connection, TRUE);
-
+
view->naws_enabled = FALSE;
-
+
view->priv->telnet = mud_telnet_new(view, view->connection);
-
+
view->local_echo = TRUE;
mud_connection_view_set_profile(view, mud_profile_new(profile));
-
+
/* Let us resize the gnome-mud window */
vte_terminal_get_padding(VTE_TERMINAL(view->priv->terminal), &xpad, &ypad);
char_width = VTE_TERMINAL(view->priv->terminal)->char_width;
char_height = VTE_TERMINAL(view->priv->terminal)->char_height;
-
+
hints.base_width = xpad;
hints.base_height = ypad;
hints.width_inc = char_width;
@@ -714,17 +714,17 @@
GDK_HINT_BASE_SIZE);
view->priv->tray = MUD_TRAY(tray);
-
+
view->priv->log = mud_log_new(name);
-
- buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
+
+ buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
view->priv->hostname, view->priv->port);
mud_connection_view_add_text(view, buf, System);
g_free(buf);
buf = NULL;
-
+
profile_name = mud_profile_get_name(view->priv->profile);
-
+
if (strcmp(profile_name, "Default"))
{
g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
@@ -733,17 +733,17 @@
g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/use_proxy");
client = gconf_client_get_default();
use_proxy = gconf_client_get_bool(client, key, NULL);
-
+
g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_hostname");
proxy_host = gconf_client_get_string(client, key, NULL);
-
+
g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_version");
version = gconf_client_get_string(client, key, NULL);
-
+
if(use_proxy)
{
if(proxy_host && version)
- {
+ {
gnet_socks_set_enabled(TRUE);
gnet_socks_set_server(gnet_inetaddr_new(proxy_host,GNET_SOCKS_PORT));
gnet_socks_set_version((strcmp(version, "4") == 0) ? 4 : 5);
@@ -751,9 +751,9 @@
}
else
gnet_socks_set_enabled(FALSE);
-
+
gnet_conn_connect(view->connection);
-
+
return view;
}
@@ -771,7 +771,7 @@
view->priv->profile = profile;
g_object_ref(G_OBJECT(profile));
- view->priv->signal_profile_changed =
+ view->priv->signal_profile_changed =
g_signal_connect(G_OBJECT(view->priv->profile), "changed",
G_CALLBACK(mud_connection_view_profile_changed_cb),
view);
@@ -807,19 +807,19 @@
MudConnectionHistoryDirection direction)
{
gchar *history_item;
-
+
if(direction == HISTORY_DOWN)
if(view->priv->current_history_index != 0)
view->priv->current_history_index--;
-
+
history_item = (gchar *)g_queue_peek_nth(view->priv->history,
view->priv->current_history_index);
-
+
if(direction == HISTORY_UP)
- if(view->priv->current_history_index <
+ if(view->priv->current_history_index <
g_queue_get_length(view->priv->history) - 1)
view->priv->current_history_index++;
-
+
return history_item;
}
@@ -834,60 +834,60 @@
gchar *buf;
gboolean temp;
MudConnectionView *view = MUD_CONNECTION_VIEW(pview);
-
+
g_assert(view != NULL);
-
+
switch(event->type)
{
case GNET_CONN_ERROR:
mud_connection_view_add_text(view, _("*** Could not connect."), Error);
break;
-
+
case GNET_CONN_CONNECT:
mud_connection_view_add_text(view, _("*** Connected.\n"), System);
gnet_conn_read(view->connection);
break;
-
+
case GNET_CONN_CLOSE:
mud_connection_view_add_text(view, _("*** Connection closed.\n"), Error);
break;
-
+
case GNET_CONN_TIMEOUT:
break;
-
+
case GNET_CONN_READ:
if(!view->priv->connected)
{
view->priv->connected = TRUE;
mud_tray_update_icon(view->priv->tray, online);
}
-
+
buffer = mud_telnet_process(view->priv->telnet, (guchar *)event->buffer, event->length);
-
+
if(buffer.len != 0)
{
string = g_string_new(NULL);
for(i = 0; i < buffer.len; i++)
g_string_append_c(string, buffer.buffer[i]);
-
+
buf = string->str;
-
+
temp = view->local_echo;
view->local_echo = FALSE;
- gag = mud_parse_base_do_triggers(view->priv->parse,
+ gag = mud_parse_base_do_triggers(view->priv->parse,
buf);
view->local_echo = temp;
-
- mud_window_handle_plugins(view->priv->window, view->priv->id,
+
+ mud_window_handle_plugins(view->priv->window, view->priv->id,
buf, buffer.len, 1);
-
+
pluggag = PluginGag;
PluginGag = FALSE;
-
+
if(!gag && !pluggag)
{
-
- vte_terminal_feed(VTE_TERMINAL(view->priv->terminal),
+
+ vte_terminal_feed(VTE_TERMINAL(view->priv->terminal),
buf, buffer.len);
mud_log_write_hook(view->priv->log, buf, buffer.len);
}
@@ -896,33 +896,33 @@
mud_connection_view_send (view, view->priv->connect_string);
view->priv->connect_hook = FALSE;
}
-
+
g_string_free(string, TRUE);
buf = NULL;
}
-
+
gnet_conn_read(view->connection);
break;
-
+
case GNET_CONN_WRITE:
break;
-
+
case GNET_CONN_READABLE:
break;
-
+
case GNET_CONN_WRITABLE:
break;
}
}
-void
+void
mud_connection_view_get_term_size(MudConnectionView *view, gint *w, gint *h)
{
VteTerminal *term = VTE_TERMINAL(view->priv->terminal);
*w = term->column_count;
*h = term->row_count;
}
-
+
void
mud_connection_view_set_naws(MudConnectionView *view, gint enabled)
{
@@ -934,9 +934,8 @@
{
if(view && view->naws_enabled)
{
- mud_telnet_send_naws(view->priv->telnet,
- VTE_TERMINAL(view->priv->terminal)->column_count,
+ mud_telnet_send_naws(view->priv->telnet,
+ VTE_TERMINAL(view->priv->terminal)->column_count,
VTE_TERMINAL(view->priv->terminal)->row_count);
}
-}
-
+}
Modified: trunk/src/mud-connection-view.h
==============================================================================
--- trunk/src/mud-connection-view.h (original)
+++ trunk/src/mud-connection-view.h Sat Jun 28 05:02:32 2008
@@ -25,11 +25,11 @@
MudConnectionViewPrivate *priv;
GConn *connection;
-
+
gint naws_enabled;
-
+
gint local_echo;
-
+
gint remote_encode;
gchar *remote_encoding;
};
Modified: trunk/src/mud-log.c
==============================================================================
--- trunk/src/mud-log.c (original)
+++ trunk/src/mud-log.c Sat Jun 28 05:02:32 2008
@@ -39,7 +39,7 @@
gchar *name;
gchar *filename;
gchar *dir;
-
+
FILE *logfile;
};
@@ -85,7 +85,7 @@
mud_log_init (MudLog *log)
{
log->priv = g_new0(MudLogPrivate, 1);
-
+
log->priv->active = FALSE;
log->priv->logfile = NULL;
log->priv->name = NULL;
@@ -106,7 +106,7 @@
GObjectClass *parent_class;
MLog = MUD_LOG(object);
-
+
g_free(MLog->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -115,7 +115,7 @@
// MudLog Methods
-void
+void
mud_log_open(MudLog *log)
{
gchar buf[1024];
@@ -123,77 +123,77 @@
time_t t;
g_snprintf(buf, 1024, "%s/.gnome-mud/logs/%s", g_get_home_dir(), log->priv->name);
-
+
log->priv->dir = g_strdup(buf);
-
+
if(!g_file_test(buf, G_FILE_TEST_IS_DIR))
- if(mkdir(buf, 0777 ) == -1)
+ if(mkdir(buf, 0777 ) == -1)
return;
g_snprintf(nameBuf, 1024, "%s.log", log->priv->name);
-
+
log->priv->filename = g_build_path( G_DIR_SEPARATOR_S, log->priv->dir, nameBuf, NULL);
log->priv->logfile = fopen(log->priv->filename, "a");
if (log->priv->logfile)
{
- time(&t);
- strftime(buf, 1024,
- _("\n*** Log starts *** %d/%m/%Y %H:%M:%S\n"),
+ time(&t);
+ strftime(buf, 1024,
+ _("\n*** Log starts *** %d/%m/%Y %H:%M:%S\n"),
localtime(&t));
fprintf(log->priv->logfile, buf);
}
-
+
log->priv->active = TRUE;
}
-void
-mud_log_write(MudLog *log, gchar *data, gsize size)
+void
+mud_log_write(MudLog *log, gchar *data, gsize size)
{
gchar *stripData;
gint stripSize = 0;
-
+
if(log->priv->logfile == NULL || data == NULL)
return;
-
+
stripData = strip_ansi((const gchar *)data);
stripSize = strlen(stripData);
-
+
fwrite(stripData, 1, stripSize, log->priv->logfile);
-
+
g_free(stripData);
}
-void
-mud_log_close(MudLog *log)
+void
+mud_log_close(MudLog *log)
{
gchar buf[255];
time_t t;
-
+
if(log->priv->logfile == NULL)
return;
-
- time(&t);
+
+ time(&t);
strftime(buf, 255,
_("\n *** Log stops *** %d/%m/%Y %H:%M:%S\n"),
localtime(&t));
fprintf(log->priv->logfile, buf);
fclose(log->priv->logfile);
-
+
log->priv->active = FALSE;
}
-void
-mud_log_remove(MudLog *log)
+void
+mud_log_remove(MudLog *log)
{
if(log->priv->active)
mud_log_close(log);
-
+
unlink(log->priv->filename);
}
-gboolean
+gboolean
mud_log_islogging(MudLog *log)
{
return log->priv->active;
@@ -201,7 +201,7 @@
// MudLog Utility Functions
-void
+void
mud_log_write_hook(MudLog *log, gchar *data, gint length)
{
if(log->priv->active)
@@ -213,13 +213,13 @@
mud_log_new(gchar *mudName)
{
MudLog *MLog;
-
+
if( mudName == NULL)
return NULL;
-
+
MLog = g_object_new(MUD_TYPE_LOG, NULL);
-
+
MLog->priv->name = mudName;
-
- return MLog;
+
+ return MLog;
}
Modified: trunk/src/mud-parse-alias.c
==============================================================================
--- trunk/src/mud-parse-alias.c (original)
+++ trunk/src/mud-parse-alias.c Sat Jun 28 05:02:32 2008
@@ -67,7 +67,7 @@
static void
mud_parse_alias_init (MudParseAlias *pa)
{
-
+
}
static void
@@ -85,14 +85,14 @@
GObjectClass *parent_class;
parse_alias = MUD_PARSE_ALIAS(object);
-
+
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
parent_class->finalize(object);
}
// MudParseAlias Methods
-gboolean
+gboolean
mud_parse_alias_do(gchar *data, MudConnectionView *view, MudRegex *regex, MudParseAlias *alias)
{
gchar *profile_name;
@@ -105,40 +105,40 @@
gint enabled;
gint ovector[1020];
gboolean send_line = TRUE;
-
+
client = gconf_client_get_default();
-
+
profile_name = mud_profile_get_name(mud_connection_view_get_current_profile(view));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/list", profile_name);
aliases = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
-
+
for (entry = aliases; entry != NULL; entry = g_slist_next(entry))
- {
- g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/enabled", profile_name, (gchar *)entry->data);
+ {
+ g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/enabled", profile_name, (gchar *)entry->data);
enabled = gconf_client_get_int(client, keyname, &error);
if(enabled)
- {
+ {
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/regex", profile_name, (gchar *)entry->data);
regexstr = gconf_client_get_string(client, keyname, &error);
-
+
if(mud_regex_check((const gchar *)data, strlen(data), regexstr, ovector, regex))
- {
+ {
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/actions", profile_name, (gchar *)entry->data);
actions = gconf_client_get_string(client, keyname, &error);
-
+
send_line = FALSE;
mud_parse_base_parse((const gchar *)actions, data, ovector, view, regex);
-
+
if(actions)
g_free(actions);
}
-
+
if(regexstr)
g_free(regexstr);
}
- }
+ }
if(aliases)
g_slist_free(aliases);
@@ -151,8 +151,8 @@
mud_parse_alias_new(void)
{
MudParseAlias *pa;
-
+
pa = g_object_new(MUD_TYPE_PARSE_ALIAS, NULL);
-
- return pa;
+
+ return pa;
}
Modified: trunk/src/mud-parse-alias.h
==============================================================================
--- trunk/src/mud-parse-alias.h (original)
+++ trunk/src/mud-parse-alias.h Sat Jun 28 05:02:32 2008
@@ -17,7 +17,7 @@
struct _MudParseAlias
{
GObject parent_instance;
-
+
MudParseAliasPrivate *priv;
};
Modified: trunk/src/mud-parse-base.c
==============================================================================
--- trunk/src/mud-parse-base.c (original)
+++ trunk/src/mud-parse-base.c Sat Jun 28 05:02:32 2008
@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <string.h>
-#include "mud-regex.h"
-#include "mud-parse-base.h"
+#include "mud-regex.h"
+#include "mud-parse-base.h"
#include "mud-parse-alias.h"
#include "mud-parse-trigger.h"
#include "mud-connection-view.h"
@@ -50,7 +50,7 @@
MudRegex *regex;
MudParseAlias *alias;
MudParseTrigger *trigger;
-
+
MudConnectionView *parentview;
};
@@ -90,9 +90,9 @@
static void
mud_parse_base_init (MudParseBase *pb)
-{
+{
pb->priv = g_new0(MudParseBasePrivate, 1);
-
+
pb->priv->regex = mud_regex_new();
pb->priv->alias = mud_parse_alias_new();
pb->priv->trigger = mud_parse_trigger_new();
@@ -113,7 +113,7 @@
GObjectClass *parent_class;
parse_base = MUD_PARSE_BASE(object);
-
+
g_free(parse_base->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -121,19 +121,19 @@
}
// MudParseBase Methods
-gboolean
+gboolean
mud_parse_base_do_triggers(MudParseBase *base, gchar *data)
{
return mud_parse_trigger_do(data, base->priv->parentview, base->priv->regex, base->priv->trigger);
}
-gboolean
+gboolean
mud_parse_base_do_aliases(MudParseBase *base, gchar *data)
{
return mud_parse_alias_do(data, base->priv->parentview, base->priv->regex, base->priv->alias);
}
-void
+void
mud_parse_base_parse(const gchar *data, gchar *stripped_data, gint ovector[1020], MudConnectionView *view, MudRegex *regex)
{
gint i, state, len, reg_num, reg_len, startword, endword, replace_len, curr_char;
@@ -143,7 +143,7 @@
gchar *send_line = NULL;
ParseObject *po = NULL;
GSList *parse_list, *entry;
-
+
parse_list = NULL;
len = strlen(data);
@@ -152,7 +152,7 @@
state = PARSE_STATE_REGISTER;
else
state = PARSE_STATE_TEXT;
-
+
for(i = 0; i < len; i++)
{
switch(state)
@@ -165,7 +165,7 @@
po->data = g_strdup(charbuf);
po->type = TOKEN_TYPE_TEXT;
-
+
if(i + 1 <= len)
{
if((data[i+1] == '%' && i + 2 <=len && !g_ascii_isdigit(data[i+2])) || data[i+1] != '%')
@@ -174,16 +174,16 @@
state = PARSE_STATE_REGISTER;
}
break;
-
+
case PARSE_STATE_INTEXT:
g_snprintf(charbuf, 2, "%c", data[i]);
po->data = g_strconcat((const gchar *)po->data, charbuf, NULL);
-
+
if(i + 2 <= len)
if(data[i+1] == '%' && g_ascii_isdigit(data[i+2])) // % by itself isn't a register.
- state = PARSE_STATE_REGISTER;
+ state = PARSE_STATE_REGISTER;
break;
-
+
case PARSE_STATE_REGISTER:
po = g_malloc(sizeof(ParseObject));
parse_list = g_slist_prepend(parse_list, (gpointer)po);
@@ -191,14 +191,14 @@
g_snprintf(charbuf, 2, "%%");
po->data = g_strdup(charbuf);
po->type = TOKEN_TYPE_REGISTER;
-
+
state = PARSE_STATE_INREGISTER;
break;
-
+
case PARSE_STATE_INREGISTER:
g_snprintf(charbuf, 2, "%c", data[i]);
po->data = g_strconcat((const gchar *)po->data, charbuf, NULL);
-
+
if(i + 1 <= len)
{
if(data[i + 1] == '%' && g_ascii_isdigit(data[i+2]))
@@ -212,19 +212,19 @@
/* We prepend items to the list for speed but we need
- to reverse it back into the proper order */
+ to reverse it back into the proper order */
if(parse_list)
parse_list = g_slist_reverse(parse_list);
-
-
+
+
// Parse what our lexer/tokenizer gave us.
for(entry = parse_list; entry != NULL; entry = g_slist_next(entry))
{
ParseObject *myParse;
-
+
myParse = (ParseObject *)entry->data;
-
+
switch(myParse->type)
{
case TOKEN_TYPE_TEXT:
@@ -236,34 +236,34 @@
else
send_line = g_strconcat((const gchar *)send_line, (const gchar *)myParse->data, NULL);
break;
-
+
case TOKEN_TYPE_REGISTER:
reg_len = strlen((gchar *)myParse->data);
-
+
/* If you need more than 510 registers, tough luck ;) -lh */
if(reg_len < 512)
{
gint k;
gint curr_digit;
gchar reg_buf[512];
-
+
for(k=0,curr_digit=1; k < strlen((gchar *)myParse->data)-1; ++k, ++curr_digit)
reg_buf[k] = (gchar)myParse->data[curr_digit];
reg_buf[strlen((gchar *)myParse->data)-1] = '\0';
-
+
reg_num = (gint)g_strtod(reg_buf, NULL);
-
+
startword = ovector[reg_num << 1];
endword = ovector[(reg_num << 1) + 1];
-
+
replace_len = endword - startword;
-
+
replace_text = malloc(replace_len * sizeof(gchar));
-
+
for(i = 0, curr_char = startword; i < replace_len; i++, curr_char++)
replace_text[i] = stripped_data[curr_char];
replace_text[replace_len] = '\0';
-
+
if(new_send_line)
{
new_send_line = FALSE;
@@ -271,7 +271,7 @@
}
else
send_line = g_strconcat((const gchar *)send_line, (const gchar *)replace_text, NULL);
-
+
g_free(replace_text);
}
else
@@ -284,17 +284,17 @@
for(entry = parse_list; entry != NULL; entry = g_slist_next(entry))
{
ParseObject *myParse;
-
+
myParse = (ParseObject *)entry->data;
-
+
g_free((myParse->data));
g_free(myParse);
}
-
+
g_slist_free(parse_list);
-
+
// We're done, send our parsed trigger actions!
- mud_connection_view_send(view, (const gchar *)send_line);
+ mud_connection_view_send(view, (const gchar *)send_line);
g_free(send_line);
}
@@ -303,10 +303,10 @@
mud_parse_base_new(MudConnectionView *parentview)
{
MudParseBase *pb;
-
+
pb = g_object_new(MUD_TYPE_PARSE_BASE, NULL);
-
+
pb->priv->parentview = parentview;
-
- return pb;
+
+ return pb;
}
Modified: trunk/src/mud-parse-base.h
==============================================================================
--- trunk/src/mud-parse-base.h (original)
+++ trunk/src/mud-parse-base.h Sat Jun 28 05:02:32 2008
@@ -17,7 +17,7 @@
struct _MudParseBase
{
GObject parent_instance;
-
+
MudParseBasePrivate *priv;
};
Modified: trunk/src/mud-parse-trigger.c
==============================================================================
--- trunk/src/mud-parse-trigger.c (original)
+++ trunk/src/mud-parse-trigger.c Sat Jun 28 05:02:32 2008
@@ -75,7 +75,7 @@
mud_parse_trigger_init (MudParseTrigger *pt)
{
pt->priv = g_new0(MudParseTriggerPrivate, 1);
-
+
}
static void
@@ -93,7 +93,7 @@
GObjectClass *parent_class;
parse_trigger = MUD_PARSE_TRIGGER(object);
-
+
g_free(parse_trigger->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -101,7 +101,7 @@
}
// MudParseTrigger Methods
-gboolean
+gboolean
mud_parse_trigger_do(gchar *data, MudConnectionView *view, MudRegex *regex, MudParseTrigger *trig)
{
gchar *profile_name;
@@ -116,26 +116,26 @@
gint gag;
gint ovector[1020];
gboolean doGag = FALSE;
-
+
client = gconf_client_get_default();
-
+
profile_name = mud_profile_get_name(mud_connection_view_get_current_profile(view));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/list", profile_name);
triggers = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
-
+
for (entry = triggers; entry != NULL; entry = g_slist_next(entry))
- {
- g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/enabled", profile_name, (gchar *)entry->data);
+ {
+ g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/enabled", profile_name, (gchar *)entry->data);
enabled = gconf_client_get_int(client, keyname, &error);
if(enabled)
{
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/regex", profile_name, (gchar *)entry->data);
regexstr = gconf_client_get_string(client, keyname, &error);
-
+
stripped_data = strip_ansi((const gchar *) data);
-
+
if(mud_regex_check((const gchar *)stripped_data, strlen(stripped_data), (const gchar *)regexstr, ovector, regex))
{
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/gag", profile_name, (gchar *)entry->data);
@@ -145,16 +145,16 @@
// way of doing this in here. - lh
if(gag)
doGag = TRUE;
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/actions", profile_name, (gchar *)entry->data);
actions = gconf_client_get_string(client, keyname, &error);
-
+
mud_parse_base_parse((const gchar *)actions, stripped_data, ovector, view, regex);
-
+
if(actions)
g_free(actions);
}
-
+
if(stripped_data)
g_free(stripped_data);
}
@@ -171,8 +171,8 @@
mud_parse_trigger_new(void)
{
MudParseTrigger *pt;
-
+
pt = g_object_new(MUD_TYPE_PARSE_TRIGGER, NULL);
-
- return pt;
+
+ return pt;
}
Modified: trunk/src/mud-parse-trigger.h
==============================================================================
--- trunk/src/mud-parse-trigger.h (original)
+++ trunk/src/mud-parse-trigger.h Sat Jun 28 05:02:32 2008
@@ -17,7 +17,7 @@
struct _MudParseTrigger
{
GObject parent_instance;
-
+
MudParseTriggerPrivate *priv;
};
Modified: trunk/src/mud-preferences-window.c
==============================================================================
--- trunk/src/mud-preferences-window.c (original)
+++ trunk/src/mud-preferences-window.c Sat Jun 28 05:02:32 2008
@@ -73,13 +73,13 @@
GtkWidget *cb_scrollback;
GtkWidget *entry_commdev;
-
+
GtkWidget *encoding_combo;
GtkWidget *encoding_check;
GtkWidget *proxy_check;
GtkWidget *proxy_combo;
GtkWidget *proxy_entry;
-
+
GtkWidget *sb_lines;
GtkWidget *fp_font;
@@ -98,7 +98,7 @@
GtkWidget *alias_match_label;
GtkWidget *alias_match_test;
GtkWidget *alias_match_entry;
-
+
GtkWidget *trigger_treeview;
GtkWidget *trigger_del;
GtkWidget *trigger_name_entry;
@@ -115,7 +115,7 @@
GtkTreeViewColumn *trigger_match_text_col;
GtkCellRenderer *trigger_match_register_renderer;
GtkCellRenderer *trigger_match_text_renderer;
-
+
GtkTreeStore *trigger_store;
GtkTreeViewColumn *trigger_name_col;
GtkTreeViewColumn *trigger_enabled_col;
@@ -137,11 +137,11 @@
GtkTreeViewColumn *alias_match_text_col;
GtkCellRenderer *alias_match_register_renderer;
GtkCellRenderer *alias_match_text_renderer;
-
+
gulong signal;
gint notification_count;
-
+
gchar *current_encoding;
};
@@ -305,7 +305,7 @@
GladeXML *glade;
GtkWidget *dialog;
gint i;
-
+
preferences->priv = g_new0(MudPreferencesWindowPrivate, 1);
preferences->priv->profile = NULL;
preferences->priv->notification_count = 0;
@@ -324,9 +324,9 @@
preferences->priv->cb_scrollback = glade_xml_get_widget(glade, "cb_scrollback");
preferences->priv->entry_commdev = glade_xml_get_widget(glade, "entry_commdev");
-
+
preferences->priv->sb_lines = glade_xml_get_widget(glade, "sb_lines");
-
+
preferences->priv->encoding_combo = glade_xml_get_widget(glade, "encoding_combo");
preferences->priv->encoding_check = glade_xml_get_widget(glade, "encoding_check");
preferences->priv->proxy_check = glade_xml_get_widget(glade, "proxy_check");
@@ -355,7 +355,7 @@
preferences->priv->alias_match_label = glade_xml_get_widget(glade, "alias_match_label");
preferences->priv->alias_match_test = glade_xml_get_widget(glade, "alias_match_test");
preferences->priv->alias_match_entry = glade_xml_get_widget(glade, "alias_match_entry");
-
+
preferences->priv->trigger_treeview = glade_xml_get_widget(glade, "trigger_treeview");
preferences->priv->trigger_del = glade_xml_get_widget(glade, "trigger_del");
preferences->priv->trigger_name_entry = glade_xml_get_widget(glade, "trigger_name_entry");
@@ -366,9 +366,9 @@
preferences->priv->trigger_match_button = glade_xml_get_widget(glade, "trigger_match_button");
preferences->priv->trigger_match_treeview = glade_xml_get_widget(glade, "trigger_match_treeview");
preferences->priv->trigger_ok = glade_xml_get_widget(glade, "trigger_ok");
-
+
//... Okay seriously.... GtkTreeView API.... WTF. lh
-
+
// Setup alias treeview
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(preferences->priv->alias_treeview), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(preferences->priv->alias_treeview), TRUE);
@@ -379,7 +379,7 @@
gtk_tree_view_append_column(GTK_TREE_VIEW(preferences->priv->alias_treeview), preferences->priv->alias_enabled_col);
gtk_tree_view_append_column(GTK_TREE_VIEW(preferences->priv->alias_treeview), preferences->priv->alias_name_col);
gtk_tree_view_column_set_title(preferences->priv->alias_name_col, _("Name"));
- gtk_tree_view_column_set_title(preferences->priv->alias_enabled_col, _("Enabled"));
+ gtk_tree_view_column_set_title(preferences->priv->alias_enabled_col, _("Enabled"));
preferences->priv->alias_name_renderer = gtk_cell_renderer_text_new();
preferences->priv->alias_enabled_renderer = gtk_cell_renderer_toggle_new();
gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(preferences->priv->alias_enabled_renderer), FALSE);
@@ -426,7 +426,7 @@
g_signal_connect(G_OBJECT(preferences->priv->trigger_enabled_renderer), "toggled", G_CALLBACK(mud_preferences_window_trigger_enabled_toggle_cb), preferences);
g_signal_connect(G_OBJECT(preferences->priv->trigger_gag_renderer), "toggled", G_CALLBACK(mud_preferences_window_trigger_gag_toggle_cb), preferences);
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(preferences->priv->trigger_treeview)), mud_preferences_window_trigger_select_cb, preferences, NULL);
-
+
// Setup trigger match treeview
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(preferences->priv->trigger_match_treeview), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(preferences->priv->trigger_match_treeview), FALSE);
@@ -439,10 +439,10 @@
preferences->priv->trigger_match_register_renderer = gtk_cell_renderer_text_new();
preferences->priv->trigger_match_text_renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(preferences->priv->trigger_match_register_col, preferences->priv->trigger_match_register_renderer, TRUE);
- gtk_tree_view_column_add_attribute(preferences->priv->trigger_match_register_col, preferences->priv->trigger_match_register_renderer,
+ gtk_tree_view_column_add_attribute(preferences->priv->trigger_match_register_col, preferences->priv->trigger_match_register_renderer,
"text", TRIGGER_MATCH_REGISTER_COLUMN);
gtk_tree_view_column_pack_start(preferences->priv->trigger_match_text_col, preferences->priv->trigger_match_text_renderer, TRUE);
- gtk_tree_view_column_add_attribute(preferences->priv->trigger_match_text_col, preferences->priv->trigger_match_text_renderer,
+ gtk_tree_view_column_add_attribute(preferences->priv->trigger_match_text_col, preferences->priv->trigger_match_text_renderer,
"text", TRIGGER_MATCH_TEXT_COLUMN);
// Setup alias match treeview
@@ -457,28 +457,28 @@
preferences->priv->alias_match_register_renderer = gtk_cell_renderer_text_new();
preferences->priv->alias_match_text_renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(preferences->priv->alias_match_register_col, preferences->priv->alias_match_register_renderer, TRUE);
- gtk_tree_view_column_add_attribute(preferences->priv->alias_match_register_col, preferences->priv->alias_match_register_renderer,
+ gtk_tree_view_column_add_attribute(preferences->priv->alias_match_register_col, preferences->priv->alias_match_register_renderer,
"text", TRIGGER_MATCH_REGISTER_COLUMN);
gtk_tree_view_column_pack_start(preferences->priv->alias_match_text_col, preferences->priv->alias_match_text_renderer, TRUE);
- gtk_tree_view_column_add_attribute(preferences->priv->alias_match_text_col, preferences->priv->alias_match_text_renderer,
+ gtk_tree_view_column_add_attribute(preferences->priv->alias_match_text_col, preferences->priv->alias_match_text_renderer,
"text", TRIGGER_MATCH_TEXT_COLUMN);
-
-
+
+
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(preferences->priv->treeview), TRUE);
-
+
g_signal_connect(G_OBJECT(preferences->priv->trigger_match_button), "clicked", G_CALLBACK(trigger_match_cb), preferences);
g_signal_connect(G_OBJECT(preferences->priv->alias_match_test), "clicked", G_CALLBACK(alias_match_cb), preferences);
-
+
gtk_widget_show_all(dialog);
-
+
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
gtk_window_present(GTK_WINDOW(dialog));
- g_signal_connect(G_OBJECT(dialog), "response",
+ 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));
}
@@ -546,20 +546,20 @@
DATA_COLUMN, NULL,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_TRIGGERS),
-1);
-
-
-
+
+
+
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,
+ gtk_tree_store_set(store, &iter,
TITLE_COLUMN, profile->name,
DATA_COLUMN, profile,
TYPE_COLUMN, GINT_TO_POINTER(COLUMN_NODE),
@@ -592,7 +592,7 @@
G_CALLBACK(mud_preferences_window_tree_selection_cb), window);
}
-gboolean
+gboolean
mud_preferences_window_trigger_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
@@ -609,49 +609,49 @@
gchar *actions;
GtkTextBuffer *regex_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->trigger_regex_textview));
GtkTextBuffer *action_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->trigger_action_textview));
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(prefs->priv->profile);
-
- if (gtk_tree_model_get_iter(model, &iter, path))
+
+ if (gtk_tree_model_get_iter(model, &iter, path))
{
gtk_entry_set_text(GTK_ENTRY(prefs->priv->trigger_match_entry), "");
gtk_label_set_text(GTK_LABEL(prefs->priv->trigger_match_label), "");
gtk_tree_store_clear(prefs->priv->trigger_match_store);
gtk_tree_model_get(model, &iter, TRIGGER_NAME_COLUMN, &prefs->priv->trigger_info.text, -1);
-
+
prefs->priv->trigger_info.row = (gtk_tree_path_get_indices(path))[0];
prefs->priv->trigger_info.iterstr = gtk_tree_model_get_string_from_iter(model, &iter);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/name", profile_name, prefs->priv->trigger_info.text);
gtk_entry_set_text(GTK_ENTRY(prefs->priv->trigger_name_entry),gconf_client_get_string(client, keyname, &error));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/regex", profile_name, prefs->priv->trigger_info.text);
regex = gconf_client_get_string(client, keyname, &error);
- if(regex)
+ if(regex)
{
gtk_text_buffer_set_text(regex_buffer, regex, strlen(regex));
g_free(regex);
}
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/actions", profile_name, prefs->priv->trigger_info.text);
actions = gconf_client_get_string(client, keyname, &error);
- if(actions)
+ if(actions)
{
gtk_text_buffer_set_text(action_buffer, actions, strlen(actions));
g_free(actions);
}
-
+
gtk_widget_set_sensitive(prefs->priv->trigger_del, TRUE);
}
-
+
return TRUE;
}
-gboolean
+gboolean
mud_preferences_window_alias_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
@@ -668,25 +668,25 @@
gchar *regex;
GtkTextBuffer *action_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->alias_textview));
GtkTextBuffer *regex_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->alias_regex_textview));
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(prefs->priv->profile);
-
- if (gtk_tree_model_get_iter(model, &iter, path))
+
+ if (gtk_tree_model_get_iter(model, &iter, path))
{
gtk_entry_set_text(GTK_ENTRY(prefs->priv->alias_entry), "");
gtk_tree_model_get(model, &iter, ALIAS_NAME_COLUMN, &prefs->priv->alias_info.text, -1);
prefs->priv->alias_info.row = (gtk_tree_path_get_indices(path))[0];
prefs->priv->alias_info.iterstr = gtk_tree_model_get_string_from_iter(model, &iter);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/name", profile_name, prefs->priv->alias_info.text);
gtk_entry_set_text(GTK_ENTRY(prefs->priv->alias_entry),gconf_client_get_string(client, keyname, &error));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/actions", profile_name, prefs->priv->alias_info.text);
actions = gconf_client_get_string(client, keyname, &error);
- if(actions)
+ if(actions)
{
gtk_text_buffer_set_text(action_buffer, actions, strlen(actions));
g_free(actions);
@@ -695,7 +695,7 @@
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/regex", profile_name, prefs->priv->alias_info.text);
regex = gconf_client_get_string(client, keyname, &error);
- if(regex)
+ if(regex)
{
gtk_text_buffer_set_text(regex_buffer, regex, strlen(regex));
g_free(regex);
@@ -703,7 +703,7 @@
gtk_widget_set_sensitive(prefs->priv->alias_del, TRUE);
}
-
+
return TRUE;
}
@@ -721,21 +721,21 @@
GConfValue *intval;
GConfClient *client;
GError *error = NULL;
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(prefs->priv->profile);
intval = gconf_value_new(GCONF_VALUE_INT);
-
+
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &iter, path);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, TRIGGER_ENABLED_COLUMN, &active, -1);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, TRIGGER_NAME_COLUMN, &name, -1);
-
+
gconf_value_set_int(intval, !active);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/enabled", profile_name, name);
gconf_client_set(client, keyname, intval, &error);
-
+
gtk_tree_store_set(model, &iter, TRIGGER_ENABLED_COLUMN, !active, -1);
-
+
g_free(name);
gconf_value_free(intval);
}
@@ -754,19 +754,19 @@
GConfValue *intval;
GConfClient *client;
GError *error = NULL;
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(prefs->priv->profile);
intval = gconf_value_new(GCONF_VALUE_INT);
-
+
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &iter, path);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, TRIGGER_GAG_COLUMN, &active, -1);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, TRIGGER_NAME_COLUMN, &name, -1);
-
+
gconf_value_set_int(intval, !active);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/gag", profile_name, name);
gconf_client_set(client, keyname, intval, &error);
-
+
gtk_tree_store_set(model, &iter, TRIGGER_GAG_COLUMN, !active, -1);
g_free(name);
@@ -792,14 +792,14 @@
profile_name = mud_profile_get_name(prefs->priv->profile);
intval = gconf_value_new(GCONF_VALUE_INT);
- gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &iter, path);
+ gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &iter, path);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, ALIAS_ENABLED_COLUMN, &active, -1);
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, ALIAS_NAME_COLUMN, &name, -1);
gconf_value_set_int(intval, !active);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/enabled", profile_name, name);
- gconf_client_set(client, keyname, intval, &error);
-
+ gconf_client_set(client, keyname, intval, &error);
+
gtk_tree_store_set(model, &iter, ALIAS_ENABLED_COLUMN, !active, -1);
gconf_value_free(intval);
@@ -813,7 +813,7 @@
GtkTreeModel *model;
MudProfile *profile = NULL;
gint type;
-
+
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
if (gtk_tree_model_iter_has_child(model, &iter))
@@ -831,9 +831,9 @@
return;
}
-
+
}
-
+
gtk_tree_model_get(model, &iter, DATA_COLUMN, &profile, TYPE_COLUMN, &type, -1);
if (profile == NULL)
@@ -858,7 +858,7 @@
mud_preferences_window_show_tab(MudPreferencesWindow *window, gint tab)
{
GtkWidget *widget;
-
+
gtk_notebook_set_current_page(GTK_NOTEBOOK(window->priv->notebook), tab);
switch (tab)
{
@@ -875,7 +875,7 @@
{
gtk_widget_destroy(dialog);
g_object_unref(window);
-
+
return FALSE;
}
@@ -924,14 +924,14 @@
g_signal_connect(G_OBJECT(window->priv->entry_commdev), "changed",
G_CALLBACK(mud_preferences_window_commdev_cb),
window);
-
+
g_signal_connect(G_OBJECT(window->priv->encoding_combo), "changed",
G_CALLBACK(mud_preferences_window_encoding_combo_cb),
window);
g_signal_connect(G_OBJECT(window->priv->encoding_check), "toggled",
G_CALLBACK(mud_preferences_window_encoding_check_cb),
window);
-
+
g_signal_connect(G_OBJECT(window->priv->proxy_check), "toggled",
G_CALLBACK(mud_preferences_window_proxy_check_cb),
window);
@@ -941,7 +941,7 @@
g_signal_connect(G_OBJECT(window->priv->proxy_entry), "changed",
G_CALLBACK(mud_preferences_window_proxy_entry_cb),
window);
-
+
g_signal_connect(G_OBJECT(window->priv->sb_lines), "changed",
G_CALLBACK(mud_preferences_window_scrollback_cb),
window);
@@ -960,7 +960,7 @@
G_CALLBACK(mud_preferences_window_colors_cb),
window);
}
-
+
g_signal_connect(G_OBJECT(window->priv->trigger_del), "clicked",
G_CALLBACK(mud_preferences_window_trigger_del_cb), window);
g_signal_connect(G_OBJECT(window->priv->trigger_ok), "clicked",
@@ -1014,7 +1014,7 @@
static void
mud_preferences_window_keeptext_cb(GtkWidget *widget, MudPreferencesWindow *window)
-{
+{
gboolean value = GTK_TOGGLE_BUTTON(widget)->active ? TRUE : FALSE;
RETURN_IF_CHANGING_PROFILES(window);
@@ -1033,7 +1033,7 @@
static void
mud_preferences_window_commdev_cb(GtkWidget *widget, MudPreferencesWindow *window)
{
-
+
const gchar *s = gtk_entry_get_text(GTK_ENTRY(widget));
RETURN_IF_CHANGING_PROFILES(window);
@@ -1132,13 +1132,13 @@
GdkColor color;
RETURN_IF_CHANGING_PROFILES(window);
-
+
for (i = 0; i < C_MAX; i++)
{
if (widget == window->priv->colors[i])
{
gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), &color);
- mud_profile_set_colors(window->priv->profile, i,
+ mud_profile_set_colors(window->priv->profile, i,
color.red, color.green, color.blue);
}
}
@@ -1152,14 +1152,14 @@
GError *error = NULL;
gchar *profile_name;
gchar keyname[2048];
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
-
+
profile_name = mud_profile_get_name(window->priv->profile);
-
+
client = gconf_client_get_default();
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/list", profile_name);
triggers = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
@@ -1170,13 +1170,13 @@
rementry->data = entry->data;
}
}
-
-
+
+
triggers = g_slist_remove(triggers, rementry->data);
-
- gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, triggers, &error);
-
- mud_preferences_window_populate_trigger_treeview(window);
+
+ gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, triggers, &error);
+
+ mud_preferences_window_populate_trigger_treeview(window);
}
static void
@@ -1187,14 +1187,14 @@
GError *error = NULL;
gchar *profile_name;
gchar keyname[2048];
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
-
+
profile_name = mud_profile_get_name(window->priv->profile);
-
+
client = gconf_client_get_default();
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/list", profile_name);
aliases = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
@@ -1205,12 +1205,12 @@
rementry->data = entry->data;
}
}
-
-
+
+
aliases = g_slist_remove(aliases, rementry->data);
-
- gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, aliases, &error);
-
+
+ gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, aliases, &error);
+
mud_preferences_window_populate_alias_treeview(window);
g_free(aliases);
@@ -1232,51 +1232,51 @@
GSList *triggers, *entry;
GtkTextBuffer *buffer_regex = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->trigger_regex_textview));
GtkTextBuffer *buffer_actions = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->trigger_action_textview));
-
+
client = gconf_client_get_default();
strval = gconf_value_new(GCONF_VALUE_STRING);
intval = gconf_value_new(GCONF_VALUE_INT);
-
+
text = (gchar *)gtk_entry_get_text(GTK_ENTRY(window->priv->trigger_name_entry));
-
+
if(!strlen(text))
return;
-
+
name = remove_whitespace(text);
-
+
profile_name = mud_profile_get_name(MUD_PROFILE(window->priv->profile));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/list",profile_name);
triggers = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, NULL);
-
+
for(entry = triggers; entry != NULL; entry = g_slist_next(entry))
if(g_ascii_strcasecmp((gchar *)entry->data,name) == 0)
newtrig = FALSE;
-
+
if(newtrig)
{
triggers = g_slist_append(triggers, (void *)name);
gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, triggers, &error);
}
-
+
gconf_value_set_string(strval, name);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/name", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
-
+
gtk_text_buffer_get_start_iter(buffer_regex, &start);
gtk_text_buffer_get_end_iter(buffer_regex, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer_regex, &start, &end, FALSE));
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/regex", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
gtk_text_buffer_get_start_iter(buffer_actions, &start);
gtk_text_buffer_get_end_iter(buffer_actions, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer_actions, &start, &end, FALSE));
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/actions", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
-
+
gconf_value_set_int(intval, 1);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/enabled", profile_name, name);
gconf_client_set(client, keyname, intval, &error);
@@ -1284,10 +1284,10 @@
gconf_value_set_int(intval, 0);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/gag", profile_name, name);
gconf_client_set(client, keyname, intval, &error);
-
+
gconf_value_free(strval);
gconf_value_free(intval);
-
+
mud_preferences_window_populate_trigger_treeview(window);
}
@@ -1307,20 +1307,20 @@
GSList *aliases, *entry;
GtkTextBuffer *buffer_actions = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->alias_textview));
GtkTextBuffer *buffer_regex = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->alias_regex_textview));
-
+
client = gconf_client_get_default();
strval = gconf_value_new(GCONF_VALUE_STRING);
intval = gconf_value_new(GCONF_VALUE_INT);
-
+
text = (gchar *)gtk_entry_get_text(GTK_ENTRY(window->priv->alias_entry));
-
+
if(!strlen(text))
return;
-
+
name = remove_whitespace(text);
-
+
profile_name = mud_profile_get_name(MUD_PROFILE(window->priv->profile));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/list",profile_name);
aliases = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, NULL);
@@ -1333,32 +1333,32 @@
aliases = g_slist_append(aliases, (void *)name);
gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, aliases, &error);
}
-
+
gconf_value_set_string(strval, name);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/name", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
-
+
gtk_text_buffer_get_start_iter(buffer_regex, &start);
gtk_text_buffer_get_end_iter(buffer_regex, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer_regex, &start, &end, FALSE));
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/regex", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
gtk_text_buffer_get_start_iter(buffer_actions, &start);
gtk_text_buffer_get_end_iter(buffer_actions, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer_actions, &start, &end, FALSE));
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/actions", profile_name, name);
gconf_client_set(client, keyname, strval, &error);
-
+
gconf_value_set_int(intval, 1);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/enabled", profile_name, name);
gconf_client_set(client, keyname, intval, &error);
-
+
gconf_value_free(strval);
gconf_value_free(intval);
-
+
mud_preferences_window_populate_alias_treeview(window);
}
@@ -1376,14 +1376,14 @@
GtkTextIter start, end;
GtkTextBuffer *buffer_regex = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->trigger_regex_textview));
GtkTextBuffer *buffer_action = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->trigger_action_textview));
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(window->priv->profile);
gtk_entry_set_text(GTK_ENTRY(window->priv->trigger_match_entry), "");
gtk_entry_set_text(GTK_ENTRY(window->priv->trigger_name_entry), "");
gtk_label_set_text(GTK_LABEL(window->priv->trigger_match_label), "");
-
+
gtk_tree_store_clear(window->priv->trigger_store);
gtk_tree_store_clear(window->priv->trigger_match_store);
@@ -1396,11 +1396,11 @@
gtk_text_buffer_get_end_iter(buffer_action, &end);
gtk_text_buffer_delete(buffer_action ,&start, &end);
-
+
gtk_widget_set_sensitive(window->priv->trigger_del, FALSE);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/list", profile_name);
-
+
triggers = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
for (entry = triggers; entry != NULL; entry = g_slist_next(entry))
{
@@ -1411,13 +1411,13 @@
gag_active = gconf_client_get_int(client, keyname, &error);
gtk_tree_store_append(window->priv->trigger_store, &iter, NULL);
- gtk_tree_store_set(window->priv->trigger_store, &iter,
+ gtk_tree_store_set(window->priv->trigger_store, &iter,
TRIGGER_ENABLED_COLUMN, enabled_active,
TRIGGER_GAG_COLUMN, gag_active,
- TRIGGER_NAME_COLUMN, (gchar *)entry->data,
+ TRIGGER_NAME_COLUMN, (gchar *)entry->data,
-1);
}
-
+
}
void
@@ -1433,14 +1433,14 @@
GtkTextIter start, end;
GtkTextBuffer *buffer_action = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->alias_textview));
GtkTextBuffer *buffer_regex = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->alias_regex_textview));
-
+
client = gconf_client_get_default();
profile_name = mud_profile_get_name(window->priv->profile);
gtk_entry_set_text(GTK_ENTRY(window->priv->alias_entry), "");
gtk_entry_set_text(GTK_ENTRY(window->priv->alias_match_entry), "");
gtk_label_set_text(GTK_LABEL(window->priv->alias_match_label), "");
-
+
gtk_tree_store_clear(window->priv->alias_store);
gtk_tree_store_clear(window->priv->alias_match_store);
@@ -1453,11 +1453,11 @@
gtk_text_buffer_get_end_iter(buffer_regex, &end);
gtk_text_buffer_delete(buffer_regex ,&start, &end);
-
+
gtk_widget_set_sensitive(window->priv->alias_del, FALSE);
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/list", profile_name);
-
+
aliases = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
for (entry = aliases; entry != NULL; entry = g_slist_next(entry))
{
@@ -1465,12 +1465,12 @@
enabled_active = gconf_client_get_int(client, keyname, &error);
gtk_tree_store_append(window->priv->alias_store, &iter, NULL);
- gtk_tree_store_set(window->priv->alias_store, &iter,
+ gtk_tree_store_set(window->priv->alias_store, &iter,
ALIAS_ENABLED_COLUMN, enabled_active,
- ALIAS_NAME_COLUMN, (gchar *)entry->data,
+ ALIAS_NAME_COLUMN, (gchar *)entry->data,
-1);
}
-
+
}
static void
@@ -1531,15 +1531,15 @@
mud_preferences_window_update_proxy_check(MudPreferencesWindow *window, MudPrefs *preferences)
{
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(window->priv->proxy_check), preferences->UseProxy);
-
+
}
static void
mud_preferences_window_update_proxy_combo(MudPreferencesWindow *window, MudPrefs *preferences)
-{
+{
gchar *profile_name;
GConfClient *client;
-
+
gchar buf[2048];
gchar extra_path[512] = "";
gchar *version;
@@ -1547,7 +1547,7 @@
gint current;
profile_name = mud_profile_get_name(window->priv->profile);
-
+
if (strcmp(profile_name, "Default"))
{
g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
@@ -1556,23 +1556,23 @@
g_snprintf(buf, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_version");
client = gconf_client_get_default();
version = gconf_client_get_string(client, buf, NULL);
-
+
if(version)
{
current = gtk_combo_box_get_active(GTK_COMBO_BOX(window->priv->proxy_combo));
-
+
if(strcmp(version,"4") == 0)
active = 0;
else
active = 1;
-
-
+
+
if(current != active)
gtk_combo_box_set_active(GTK_COMBO_BOX(window->priv->proxy_combo), active);
-
+
current = gtk_combo_box_get_active(GTK_COMBO_BOX(window->priv->proxy_combo));
}
-
+
}
static void
@@ -1580,7 +1580,7 @@
{
if(preferences->ProxyHostname)
gtk_entry_set_text(GTK_ENTRY(window->priv->proxy_entry), preferences->ProxyHostname);
-
+
}
static void
@@ -1590,29 +1590,29 @@
GtkTreeIter iter;
gboolean valid;
gint count = 0;
-
+
valid = gtk_tree_model_get_iter_first(encodings, &iter);
-
+
if(!preferences->Encoding)
return;
-
+
while(valid)
{
gchar *encoding;
-
+
gtk_tree_model_get(encodings, &iter, 0, &encoding, -1);
-
+
if(!encoding)
continue;
-
+
if(strcmp(encoding, preferences->Encoding) == 0)
break;
-
+
count++;
-
+
valid = gtk_tree_model_iter_next(encodings, &iter);
}
-
+
gtk_combo_box_set_active(GTK_COMBO_BOX(window->priv->encoding_combo), count);
}
@@ -1620,7 +1620,7 @@
mud_preferences_window_update_encoding_check(MudPreferencesWindow *window, MudPrefs *preferences)
{
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(window->priv->encoding_check), preferences->UseRemoteEncoding);
-
+
}
static void
@@ -1659,7 +1659,7 @@
gtk_color_button_set_color(GTK_COLOR_BUTTON(window->priv->cp_foreground), &color);
}
-
+
static void
mud_preferences_window_update_background(MudPreferencesWindow *window, MudPrefs *preferences)
{
@@ -1688,7 +1688,7 @@
}
}
-void
+void
trigger_match_cb(GtkWidget *widget, MudPreferencesWindow *prefs)
{
gint i;
@@ -1703,13 +1703,13 @@
GtkTextIter start, end;
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->trigger_regex_textview));
gchar buf[512];
-
+
gtk_label_set_text(GTK_LABEL(prefs->priv->trigger_match_label), "");
-
+
gtk_tree_store_clear(prefs->priv->trigger_match_store);
-
+
test_string = gtk_entry_get_text(GTK_ENTRY(prefs->priv->trigger_match_entry));
-
+
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
regex = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
@@ -1732,34 +1732,34 @@
glade = glade_xml_new(GLADEDIR "/prefs.glade", "regex_error_dialog", NULL);
dialog = glade_xml_get_widget(glade, "regex_error_dialog");
-
+
errcode_lbl = glade_xml_get_widget(glade, "errcode_label");
errstring_lbl = glade_xml_get_widget(glade, "errorstring_label");
regex_lbl = glade_xml_get_widget(glade, "regex_label");
-
+
markup = g_markup_printf_escaped ("<b>%d</b>", errorcode);
gtk_label_set_markup (GTK_LABEL(errcode_lbl), markup);
g_free(markup);
-
+
markup = g_markup_printf_escaped("<b>%s</b>", _("Error in Regex."));
gtk_label_set_markup (GTK_LABEL(prefs->priv->trigger_match_label), markup);
g_free(markup);
-
+
gtk_label_set_text(GTK_LABEL(errstring_lbl), error);
-
+
for(i = 0; i < erroroffset - 1; ++i)
buf[i] = regex[i];
buf[erroroffset - 1] = '\0';
-
+
g_snprintf(buf2, 2048, "%s<b>%c</b>", buf, regex[erroroffset-1]);
j = 0;
for(i = erroroffset; i < strlen(regex); i++, j++)
buf[j] = regex[i];
buf[j] = '\0';
-
+
g_snprintf(buf3, 2048, "%s%s", buf2, buf);
-
+
gtk_label_set_markup (GTK_LABEL(regex_lbl), buf3);
result = gtk_dialog_run(GTK_DIALOG(dialog));
@@ -1775,10 +1775,10 @@
for(i = 0; i < rc; ++i)
{
g_snprintf(buf, 512, "%%%d", i);
-
+
gtk_tree_store_append(prefs->priv->trigger_match_store, &iter, NULL);
- gtk_tree_store_set(prefs->priv->trigger_match_store, &iter,
- TRIGGER_MATCH_REGISTER_COLUMN, buf,
+ gtk_tree_store_set(prefs->priv->trigger_match_store, &iter,
+ TRIGGER_MATCH_REGISTER_COLUMN, buf,
TRIGGER_MATCH_TEXT_COLUMN, matched_strings[i],
-1);
}
@@ -1793,7 +1793,7 @@
}
}
-void
+void
alias_match_cb(GtkWidget *widget, MudPreferencesWindow *prefs)
{
gint i;
@@ -1808,13 +1808,13 @@
GtkTextIter start, end;
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(prefs->priv->alias_regex_textview));
gchar buf[512];
-
+
gtk_label_set_text(GTK_LABEL(prefs->priv->alias_match_label), "");
-
+
gtk_tree_store_clear(prefs->priv->alias_match_store);
-
+
test_string = gtk_entry_get_text(GTK_ENTRY(prefs->priv->alias_match_entry));
-
+
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
regex = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
@@ -1837,34 +1837,34 @@
glade = glade_xml_new(GLADEDIR "/prefs.glade", "regex_error_dialog", NULL);
dialog = glade_xml_get_widget(glade, "regex_error_dialog");
-
+
errcode_lbl = glade_xml_get_widget(glade, "errcode_label");
errstring_lbl = glade_xml_get_widget(glade, "errorstring_label");
regex_lbl = glade_xml_get_widget(glade, "regex_label");
-
+
markup = g_markup_printf_escaped ("<b>%d</b>", errorcode);
gtk_label_set_markup (GTK_LABEL(errcode_lbl), markup);
g_free(markup);
-
+
markup = g_markup_printf_escaped("<b>%s</b>", _("Error in Regex."));
gtk_label_set_markup (GTK_LABEL(prefs->priv->alias_match_label), markup);
g_free(markup);
-
+
gtk_label_set_text(GTK_LABEL(errstring_lbl), error);
-
+
for(i = 0; i < erroroffset - 1; ++i)
buf[i] = regex[i];
buf[erroroffset - 1] = '\0';
-
+
g_snprintf(buf2, 2048, "%s<b>%c</b>", buf, regex[erroroffset-1]);
j = 0;
for(i = erroroffset; i < strlen(regex); i++, j++)
buf[j] = regex[i];
buf[j] = '\0';
-
+
g_snprintf(buf3, 2048, "%s%s", buf2, buf);
-
+
gtk_label_set_markup (GTK_LABEL(regex_lbl), buf3);
result = gtk_dialog_run(GTK_DIALOG(dialog));
@@ -1880,10 +1880,10 @@
for(i = 0; i < rc; ++i)
{
g_snprintf(buf, 512, "%%%d", i);
-
+
gtk_tree_store_append(prefs->priv->alias_match_store, &iter, NULL);
- gtk_tree_store_set(prefs->priv->alias_match_store, &iter,
- TRIGGER_MATCH_REGISTER_COLUMN, buf,
+ gtk_tree_store_set(prefs->priv->alias_match_store, &iter,
+ TRIGGER_MATCH_REGISTER_COLUMN, buf,
TRIGGER_MATCH_TEXT_COLUMN, matched_strings[i],
-1);
}
Modified: trunk/src/mud-profile.c
==============================================================================
--- trunk/src/mud-profile.c (original)
+++ trunk/src/mud-profile.c Sat Jun 28 05:02:32 2008
@@ -56,7 +56,7 @@
{
GList *entry = NULL;
MudProfile *profile;
-
+
entry = profile_list;
for (entry = profile_list; entry != NULL; entry = entry->next)
@@ -152,13 +152,13 @@
profile = MUD_PROFILE(object);
- g_free(profile->priv->preferences.FontName);
- g_free(profile->priv->preferences.TabLocation);
- g_free(profile->priv->preferences.CommDev);
- g_free(profile->priv->preferences.TerminalType);
+ g_free(profile->priv->preferences.FontName);
+ g_free(profile->priv->preferences.TabLocation);
+ g_free(profile->priv->preferences.CommDev);
+ g_free(profile->priv->preferences.TerminalType);
g_free(profile->priv->preferences.MudListFile);
g_free(profile->priv->preferences.LastLogDir);
-
+
g_free(profile->priv);
g_free(profile->name);
@@ -174,18 +174,18 @@
GError *error = NULL;
gchar buf[512];
GConfClient *client;
-
+
client = gconf_client_get_default();
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
profile = get_profile(name);
-
+
if (profile)
{
profile_list = g_list_remove(profile_list, profile);
-
+
g_snprintf(buf, 512, "/apps/gnome-mud/profiles/list");
profiles = gconf_client_get_list(client, buf, GCONF_VALUE_STRING, &error);
for (entry = profiles; entry != NULL; entry = g_slist_next(entry))
@@ -197,7 +197,7 @@
}
profiles = g_slist_remove(profiles, rementry->data);
- gconf_client_set_list(client, buf, GCONF_VALUE_STRING, profiles, &error);
+ gconf_client_set_list(client, buf, GCONF_VALUE_STRING, profiles, &error);
}
}
@@ -213,19 +213,19 @@
profile = get_profile(name);
if (profile == NULL)
- {
+ {
profile = g_object_new(MUD_TYPE_PROFILE, NULL);
profile->name = g_strdup(name);
profile->preferences = &profile->priv->preferences;
- gm_gconf_load_preferences(profile);
+ gm_gconf_load_preferences(profile);
profile_list = g_list_append(profile_list, profile);
if (!strcmp(name, "Default"))
{
gconf_client_notify_add(profile->priv->gconf_client,
- "/apps/gnome-mud",
+ "/apps/gnome-mud",
mud_profile_gconf_changed,
profile, NULL, NULL);
}
@@ -234,7 +234,7 @@
gchar buf[512];
newflag = 1;
-
+
g_snprintf(buf, 512, "/apps/gnome-mud/profiles/list");
profiles = gconf_client_get_list(gconf_client_get_default(), buf, GCONF_VALUE_STRING, &error);
@@ -249,10 +249,10 @@
if (newflag)
{
profiles = g_slist_append(profiles, (void *)g_strdup(name));
- gconf_client_set_list(gconf_client_get_default(), buf, GCONF_VALUE_STRING, profiles, &error);
+ gconf_client_set_list(gconf_client_get_default(), buf, GCONF_VALUE_STRING, profiles, &error);
}
-
- g_snprintf(buf, 512, "/apps/gnome-mud/profiles/%s", name);
+
+ g_snprintf(buf, 512, "/apps/gnome-mud/profiles/%s", name);
gconf_client_notify_add(profile->priv->gconf_client,
buf,
mud_profile_gconf_changed,
@@ -332,7 +332,7 @@
{
g_printerr(ngettext("Palette had %d entry instead of %d\n",
"Palette had %d entries instead of %d\n",
- n_colors),
+ n_colors),
n_colors, C_MAX);
return FALSE;
@@ -366,7 +366,7 @@
{
if (candidate && strcmp(profile->priv->preferences.CommDev, candidate) == 0)
return FALSE;
-
+
if (candidate != NULL)
{
g_free(profile->priv->preferences.CommDev);
@@ -408,10 +408,10 @@
static gboolean
set_ProxyVersion(MudProfile *profile, const gchar *candidate)
{
-
+
if (candidate && strcmp(profile->priv->preferences.ProxyVersion, candidate) == 0)
return FALSE;
-
+
if (candidate != NULL)
{
g_free(profile->priv->preferences.ProxyVersion);
@@ -427,7 +427,7 @@
{
if (candidate && strcmp(profile->priv->preferences.ProxyHostname, candidate) == 0)
return FALSE;
-
+
if (candidate != NULL)
{
g_free(profile->priv->preferences.ProxyHostname);
@@ -443,7 +443,7 @@
{
if (candidate && strcmp(profile->priv->preferences.Encoding, candidate) == 0)
return FALSE;
-
+
if (candidate != NULL)
{
g_free(profile->priv->preferences.Encoding);
@@ -526,9 +526,9 @@
setting = gconf_value_get_int(val); \
\
mask.FName = set_##FName(profile, setting);
-
-
+
+
if (0)
{
;
@@ -548,7 +548,7 @@
UPDATE_STRING("proxy_hostname", ProxyHostname, "127.0.0.1");
UPDATE_STRING("encoding", Encoding, "ISO-8859-1");
UPDATE_BOOLEAN("use_proxy", UseProxy, FALSE);
- UPDATE_BOOLEAN("remote_encoding", UseRemoteEncoding, FALSE);
+ UPDATE_BOOLEAN("remote_encoding", UseRemoteEncoding, FALSE);
}
#undef UPDATE_BOOLEAN
@@ -611,7 +611,7 @@
gconf_client_set_string(profile->priv->gconf_client, key, value, NULL);
}
-void
+void
mud_profile_set_encoding_combo(MudProfile *profile, const gchar *e)
{
GError *error = NULL;
@@ -621,7 +621,7 @@
gconf_client_set_string(profile->priv->gconf_client, key, e, &error);
}
-void
+void
mud_profile_set_encoding_check (MudProfile *profile, const gint value)
{
const gchar *key = mud_profile_gconf_get_key(profile, "functionality/remote_encoding");
@@ -630,7 +630,7 @@
gconf_client_set_bool(profile->priv->gconf_client, key, value, NULL);
}
-void
+void
mud_profile_set_proxy_check (MudProfile *profile, const gint value)
{
const gchar *key = mud_profile_gconf_get_key(profile, "functionality/use_proxy");
@@ -639,24 +639,24 @@
gconf_client_set_bool(profile->priv->gconf_client, key, value, NULL);
}
-static void
+static void
mud_profile_set_proxy_combo_full(MudProfile *profile, gchar *version)
{
const gchar *key = mud_profile_gconf_get_key(profile, "functionality/proxy_version");
RETURN_IF_NOTIFYING(profile);
-
+
gconf_client_set_string(profile->priv->gconf_client, key, version, NULL);
}
-void
+void
mud_profile_set_proxy_combo(MudProfile *profile, GtkComboBox *combo)
{
gchar *version = gtk_combo_box_get_active_text(combo);
-
+
mud_profile_set_proxy_combo_full(profile, version);
}
-void
+void
mud_profile_set_proxy_entry (MudProfile *profile, const gchar *value)
{
const gchar *key = mud_profile_gconf_get_key(profile, "functionality/proxy_hostname");
@@ -683,13 +683,13 @@
GdkColor color;
gchar *s;
const gchar *key = mud_profile_gconf_get_key(profile, "ui/foreground_color");
-
+
RETURN_IF_NOTIFYING(profile);
color.red = r;
color.green = g;
color.blue = b;
-
+
s = color_to_string(&color);
gconf_client_set_string(profile->priv->gconf_client, key, s, NULL);
@@ -702,13 +702,13 @@
GdkColor color;
gchar *s;
const gchar *key = mud_profile_gconf_get_key(profile, "ui/background_color");
-
+
RETURN_IF_NOTIFYING(profile);
color.red = r;
color.green = g;
color.blue = b;
-
+
s = color_to_string(&color);
gconf_client_set_string(profile->priv->gconf_client, key, s, NULL);
g_free(s);
@@ -768,7 +768,7 @@
GSList *profiles, *entry;
g_return_if_fail(profile_list == NULL);
-
+
profiles = gconf_client_get_list(gconf_client_get_default(), "/apps/gnome-mud/profiles/list", GCONF_VALUE_STRING, NULL);
for (entry = profiles; entry != NULL; entry = g_slist_next(entry))
@@ -851,32 +851,32 @@
{
GList *entry;
gint counter = 0;
-
+
for (entry = (GList *)profile_list; entry != NULL; entry = g_list_next(entry))
{
if (counter == num)
{
return (gchar *)MUD_PROFILE(entry->data)->name;
- }
+ }
counter++;
}
-
+
return NULL;
}
-gint
+gint
mud_profile_num_from_name(gchar *name)
{
GList *entry;
gint counter = 0;
-
+
for (entry = (GList *)profile_list; entry != NULL; entry = g_list_next(entry))
{
if (!strcmp((gchar *)MUD_PROFILE(entry->data)->name,name))
{
return counter;
- }
+ }
counter++;
}
@@ -895,4 +895,3 @@
{
return profile_list;
}
-
Modified: trunk/src/mud-profile.h
==============================================================================
--- trunk/src/mud-profile.h (original)
+++ trunk/src/mud-profile.h Sat Jun 28 05:02:32 2008
@@ -37,10 +37,10 @@
gint FlushInterval;
GdkColor Foreground;
GdkColor Background;
-
+
GSList *alias_names;
GSList *trigger_names;
-
+
gboolean UseRemoteEncoding;
gboolean UseProxy;
gchar *Encoding;
@@ -83,7 +83,7 @@
struct _MudProfileClass
{
GObjectClass parent_class;
-
+
void (* changed) (MudProfile *profile, MudProfileMask *mask, gpointer data);
};
Modified: trunk/src/mud-regex.c
==============================================================================
--- trunk/src/mud-regex.c (original)
+++ trunk/src/mud-regex.c Sat Jun 28 05:02:32 2008
@@ -26,8 +26,8 @@
#include <string.h>
#include <glib/gprintf.h>
-#include "mud-regex.h"
-
+#include "mud-regex.h"
+
struct _MudRegexPrivate
{
const gchar **substring_list;
@@ -71,8 +71,8 @@
static void
mud_regex_init (MudRegex *regex)
{
- regex->priv = g_new0(MudRegexPrivate, 1);
-
+ regex->priv = g_new0(MudRegexPrivate, 1);
+
regex->priv->substring_list = NULL;
regex->priv->substring_count = 0;
}
@@ -92,7 +92,7 @@
GObjectClass *parent_class;
regex = MUD_REGEX(object);
-
+
g_free(regex->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -101,7 +101,7 @@
// MudRegex Methods
-gboolean
+gboolean
mud_regex_check(const gchar *data, guint length, const gchar *rx, gint ovector[1020], MudRegex *regex)
{
pcre *re = NULL;
@@ -109,41 +109,41 @@
gint errorcode;
gint erroroffset;
gint rc;
-
+
re = pcre_compile2(rx, 0, &errorcode, &error, &erroroffset, NULL);
-
+
if(!re)
{
gint i;
-
+
/* This should never be called since we check the regex validity
at entry time. But You Never Know(tm) so its here to catch
any runtime errors that cosmic rays, evil magic, errant gconf
editing, and Monday mornings might produce. */
-
+
g_warning("Error in Regex! - ErrCode: %d - %s", errorcode, error);
g_printf("--> %s\n ", rx);
-
+
for(i = 0; i < erroroffset - 1; i++)
g_printf(" ");
-
+
g_printf("^\n");
-
+
return FALSE;
-
+
}
rc = pcre_exec(re, NULL, data, length, 0, 0, ovector, 1020);
if(rc < 0)
return FALSE;
-
+
if(regex->priv->substring_list)
pcre_free_substring_list(regex->priv->substring_list);
-
+
pcre_get_substring_list(data, ovector, rc, ®ex->priv->substring_list);
regex->priv->substring_count = rc;
-
+
return TRUE;
}
@@ -153,23 +153,23 @@
pcre *re = NULL;
gint ovector[1020];
const gchar **sub_list;
-
+
if(!data)
return NULL;
-
+
re = pcre_compile2(rx, 0, errorcode, error, erroroffset, NULL);
if(!re)
return NULL;
-
+
*rc = pcre_exec(re, NULL, data, length, 0, 0, ovector, 1020);
-
+
pcre_get_substring_list(data, ovector, *rc, &sub_list);
-
+
return sub_list;
}
-void
+void
mud_regex_substring_clear(const gchar **substring_list)
{
pcre_free_substring_list(substring_list);
@@ -188,8 +188,8 @@
mud_regex_new(void)
{
MudRegex *regex;
-
+
regex = g_object_new(MUD_TYPE_REGEX, NULL);
-
- return regex;
+
+ return regex;
}
Modified: trunk/src/mud-regex.h
==============================================================================
--- trunk/src/mud-regex.h (original)
+++ trunk/src/mud-regex.h Sat Jun 28 05:02:32 2008
@@ -17,7 +17,7 @@
struct _MudRegex
{
GObject parent_instance;
-
+
MudRegexPrivate *priv;
};
Modified: trunk/src/mud-telnet-handlers.c
==============================================================================
--- trunk/src/mud-telnet-handlers.c (original)
+++ trunk/src/mud-telnet-handlers.c Sat Jun 28 05:02:32 2008
@@ -20,7 +20,7 @@
* wxMUD - an open source cross-platform MUD client.
* Copyright (C) 2003-2008 Mart Raudsepp and Gabriel Levin
*/
-
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -36,59 +36,59 @@
/* TTYPE */
-void
+void
MudHandler_TType_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = TRUE;
telnet->ttype_iteration = 0;
}
-void
+void
MudHandler_TType_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = FALSE;
}
-void
+void
MudHandler_TType_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
switch(telnet->ttype_iteration)
{
case 0:
- mud_telnet_send_sub_req(telnet, 11,
+ mud_telnet_send_sub_req(telnet, 11,
(guchar)TELOPT_TTYPE,
(guchar)TEL_TTYPE_IS,
'g','n','o','m','e','-','m','u','d');
telnet->ttype_iteration++;
break;
-
+
case 1:
- mud_telnet_send_sub_req(telnet, 7,
+ mud_telnet_send_sub_req(telnet, 7,
(guchar)TELOPT_TTYPE,
(guchar)TEL_TTYPE_IS,
'x','t','e','r','m');
telnet->ttype_iteration++;
break;
-
+
case 2:
- mud_telnet_send_sub_req(telnet, 6,
+ mud_telnet_send_sub_req(telnet, 6,
(guchar)TELOPT_TTYPE,
(guchar)TEL_TTYPE_IS,
'a','n','s','i');
telnet->ttype_iteration++;
break;
-
+
case 3:
- mud_telnet_send_sub_req(telnet, 9,
+ mud_telnet_send_sub_req(telnet, 9,
(guchar)TELOPT_TTYPE,
(guchar)TEL_TTYPE_IS,
'U','N','K','N','O','W','N');
telnet->ttype_iteration++;
break;
-
+
case 4:
- mud_telnet_send_sub_req(telnet, 9,
+ mud_telnet_send_sub_req(telnet, 9,
(guchar)TELOPT_TTYPE,
(guchar)TEL_TTYPE_IS,
'U','N','K','N','O','W','N');
@@ -98,89 +98,89 @@
}
/* NAWS */
-void
+void
MudHandler_NAWS_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
gint w, h;
-
+
mud_telnet_get_parent_size(telnet, &w, &h);
mud_telnet_set_parent_naws(telnet, TRUE);
-
+
handler->enabled = TRUE;
-
+
mud_telnet_send_naws(telnet, w, h);
}
-void
+void
MudHandler_NAWS_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = FALSE;
mud_telnet_set_parent_naws(telnet, FALSE);
}
-void
-MudHandler_NAWS_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void
+MudHandler_NAWS_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
- return;
+ return;
}
/* ECHO */
-void
+void
MudHandler_ECHO_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
mud_telnet_set_local_echo(telnet, FALSE);
}
-void
+void
MudHandler_ECHO_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
mud_telnet_set_local_echo(telnet, TRUE);
}
-void
-MudHandler_ECHO_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void
+MudHandler_ECHO_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
- return;
+ return;
}
/* EOR */
-void
+void
MudHandler_EOR_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
telnet->eor_enabled = TRUE;
}
-void
+void
MudHandler_EOR_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
telnet->eor_enabled = FALSE;
}
-void
-MudHandler_EOR_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void
+MudHandler_EOR_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
- return;
+ return;
}
/* CHARSET */
-void
+void
MudHandler_CHARSET_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = TRUE;
}
-void
+void
MudHandler_CHARSET_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = FALSE;
mud_telnet_set_parent_remote_encode(telnet, FALSE, NULL);
}
-void
-MudHandler_CHARSET_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void
+MudHandler_CHARSET_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
gint index = 0;
@@ -189,68 +189,68 @@
gchar sep_buf[2];
GString *encoding;
gchar **encodings;
-
+
switch(buf[index])
{
case TEL_CHARSET_REQUEST:
- // Check for [TTABLE] and
+ // Check for [TTABLE] and
// reject if found.
memcpy(&buf[1], tbuf, 8);
tbuf[8] = '\0';
-
+
if(strcmp((gchar *)tbuf, "[TTABLE]") == 0)
{
- mud_telnet_send_sub_req(telnet, 2,
+ mud_telnet_send_sub_req(telnet, 2,
(guchar)TELOPT_CHARSET,
(guchar)TEL_CHARSET_TTABLE_REJECTED);
return;
}
-
+
sep = buf[++index];
index++;
-
+
encoding = g_string_new(NULL);
-
+
while(buf[index] != (guchar)TEL_SE)
g_string_append_c(encoding, buf[index++]);
-
+
sep_buf[0] = (gchar)sep;
sep_buf[1] = '\0';
encodings = g_strsplit(encoding->str, sep_buf, -1);
-
+
// We are using VTE's locale fallback function
// to handle a charset we do not support so we
// just take the first returned and use it.
-
+
if(g_strv_length(encodings) != 0)
mud_telnet_set_parent_remote_encode(telnet, TRUE, encodings[0]);
-
+
mud_telnet_send_charset_req(telnet, encodings[0]);
-
+
g_string_free(encoding, TRUE);
g_strfreev(encodings);
-
+
break;
}
}
/* ZMP */
-void
+void
MudHandler_ZMP_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
{
handler->enabled = TRUE;
mud_zmp_init(telnet);
}
-void
+void
MudHandler_ZMP_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
{
/* Cannot disable ZMP once enabled per specification */
return;
}
-void
-MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void
+MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler)
{
gchar command_buf[1024];
@@ -260,11 +260,11 @@
gchar **argv;
gint argc;
MudZMPFunction zmp_handler = NULL;
-
+
while(buf[count] != '\0' && count < len)
command_buf[index++] = buf[count++];
command_buf[index] = '\0';
-
+
while(count < len - 1)
{
if(buf[count] == '\0')
@@ -273,27 +273,26 @@
count++;
continue;
}
-
+
g_string_append_c(args, buf[count++]);
}
-
+
g_string_prepend(args, command_buf);
-
+
argv = g_strsplit(args->str, "|gmud_sep|", -1);
argc = g_strv_length(argv);
-
+
if(mud_zmp_has_command(telnet, command_buf))
{
zmp_handler = mud_zmp_get_function(telnet, command_buf);
-
+
if(zmp_handler)
zmp_handler(telnet, argc, argv);
else
g_warning("NULL ZMP functioned returned.");
}
-
+
g_strfreev(argv);
g_string_free(args, TRUE);
-
-}
+}
Modified: trunk/src/mud-telnet-handlers.h
==============================================================================
--- trunk/src/mud-telnet-handlers.h (original)
+++ trunk/src/mud-telnet-handlers.h Sat Jun 28 05:02:32 2008
@@ -29,38 +29,37 @@
/* TTYPE */
void MudHandler_TType_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_TType_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_TType_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_TType_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
-
+
/* NAWS */
void MudHandler_NAWS_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_NAWS_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_NAWS_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_NAWS_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
-
+
/* ECHO */
void MudHandler_ECHO_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_ECHO_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_ECHO_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_ECHO_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
-
+
/* EOR */
void MudHandler_EOR_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_EOR_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_EOR_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_EOR_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
-
+
/* CHARSET */
void MudHandler_CHARSET_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_CHARSET_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_CHARSET_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_CHARSET_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
/* ZMP */
void MudHandler_ZMP_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
void MudHandler_ZMP_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
-void MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+void MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
guint len, MudTelnetHandler *handler);
-
-#endif // MUD_TELNET_HANDLERS_H
+#endif // MUD_TELNET_HANDLERS_H
Modified: trunk/src/mud-telnet-zmp.c
==============================================================================
--- trunk/src/mud-telnet-zmp.c (original)
+++ trunk/src/mud-telnet-zmp.c Sat Jun 28 05:02:32 2008
@@ -16,11 +16,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* Code originally from wxMUD. Converted to a GObject by Les Harris.
- * wxMUD - an open source cross-platform MUD client.
- * Copyright (C) 2003-2008 Mart Raudsepp and Gabriel Levin
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -47,7 +42,7 @@
static void ZMP_check(MudTelnet *telnet, gint argc, gchar **argv);
/* Public Interface */
-void
+void
mud_zmp_init(MudTelnet *telnet)
{
telnet->zmp_commands = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -56,7 +51,7 @@
mud_zmp_register_core_functions(telnet);
}
-void
+void
mud_zmp_finalize(MudTelnet *telnet)
{
if(telnet->zmp_commands)
@@ -65,10 +60,10 @@
void
mud_zmp_register(MudTelnet *telnet, MudZMPCommand *command)
-{
+{
if(command && mud_zmp_has_command(telnet, command->name))
return; // Function already registered.
-
+
g_hash_table_insert(telnet->zmp_commands, g_strdup(command->name), command);
}
@@ -83,22 +78,22 @@
{
GList *keys = g_hash_table_get_keys(telnet->zmp_commands);
GList *iter;
-
+
for(iter = g_list_first(keys); iter != NULL; iter = g_list_next(iter))
{
- MudZMPCommand *command =
- (MudZMPCommand *)g_hash_table_lookup(telnet->zmp_commands,
+ MudZMPCommand *command =
+ (MudZMPCommand *)g_hash_table_lookup(telnet->zmp_commands,
(gchar *)iter->data);
-
+
if(strcmp(command->package, package) == 0)
{
g_list_free(keys);
return TRUE;
}
}
-
+
g_list_free(keys);
-
+
return FALSE;
}
@@ -107,15 +102,15 @@
{
MudZMPFunction ret = NULL;
MudZMPCommand *val;
-
+
if(!mud_zmp_has_command(telnet, name))
return NULL;
-
+
val = (MudZMPCommand *)g_hash_table_lookup(telnet->zmp_commands, name);
-
+
if(val)
ret = (MudZMPFunction)val->execute;
-
+
return ret;
}
@@ -131,32 +126,32 @@
va_list va;
va_start(va, count);
gchar *arg;
-
+
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TEL_SB;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TELOPT_ZMP;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
for (i = 0; i < count; ++i)
{
arg = (gchar *)va_arg(va, gchar *);
-
+
for(j = 0; j < strlen(arg); ++j)
{
byte = (guchar)arg[j];
-
+
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
if (byte == (guchar)TEL_IAC)
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
-
+
gnet_conn_write(telnet->conn, (gchar *)&null, 1);
}
va_end(va);
-
+
byte = (guchar)TEL_IAC;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TEL_SE;
@@ -168,46 +163,46 @@
{
gint count = 4;
gint i;
-
+
telnet->commands[0].name = g_strdup("zmp.ident");
telnet->commands[0].package = g_strdup("zmp.");
telnet->commands[0].execute = ZMP_ident;
-
+
telnet->commands[1].name = g_strdup("zmp.ping");
telnet->commands[1].package = g_strdup("zmp.");
telnet->commands[1].execute = ZMP_ping_and_time;
-
+
telnet->commands[2].name = g_strdup("zmp.time");
telnet->commands[2].package = g_strdup("zmp.");
telnet->commands[2].execute = ZMP_ping_and_time;
-
+
telnet->commands[3].name = g_strdup("zmp.check");
telnet->commands[3].package = g_strdup("zmp.");
telnet->commands[3].execute = ZMP_check;
-
+
for(i = 0; i < count; ++i)
mud_zmp_register(telnet, &telnet->commands[i]);
}
-static void
+static void
mud_zmp_destroy_key(gpointer k)
{
gchar *key = (gchar *)k;
-
+
if(key)
g_free(key);
}
-static void
+static void
mud_zmp_destroy_command(gpointer c)
{
MudZMPCommand *command = (MudZMPCommand *)c;
-
+
if(command)
{
if(command->name)
g_free(command->name);
-
+
if(command->package)
g_free(command->package);
}
@@ -217,19 +212,19 @@
static void
ZMP_ident(MudTelnet *telnet, gint argc, gchar **argv)
{
- mud_zmp_send_command(telnet, 4,
- "zmp.ident", "gnome-mud", "0.11",
+ mud_zmp_send_command(telnet, 4,
+ "zmp.ident", "gnome-mud", "0.11",
"A mud client written for the GNOME environment.");
}
-static void
+static void
ZMP_ping_and_time(MudTelnet *telnet, gint argc, gchar **argv)
{
time_t t;
time(&t);
gchar time_buffer[128];
-
- strftime(time_buffer, sizeof(time_buffer),
+
+ strftime(time_buffer, sizeof(time_buffer),
"%Y-%m-%d %H:%M:%S", gmtime(&t));
mud_zmp_send_command(telnet, 2, "zmp.time", time_buffer);
@@ -239,7 +234,7 @@
ZMP_check(MudTelnet *telnet, gint argc, gchar **argv)
{
gchar *item = argv[1];
-
+
if(item[strlen(item) - 1] == '.') // Check for package.
{
if(mud_zmp_has_package(telnet, item))
@@ -253,6 +248,5 @@
mud_zmp_send_command(telnet, 2, "zmp.support", item);
else
mud_zmp_send_command(telnet, 2, "zmp.no-support", item);
- }
+ }
}
-
Modified: trunk/src/mud-telnet-zmp.h
==============================================================================
--- trunk/src/mud-telnet-zmp.h (original)
+++ trunk/src/mud-telnet-zmp.h Sat Jun 28 05:02:32 2008
@@ -38,4 +38,3 @@
MudZMPFunction mud_zmp_get_function(MudTelnet *telnet, gchar *name);
#endif // MUD_TELNET_ZMP_H
-
Modified: trunk/src/mud-telnet.c
==============================================================================
--- trunk/src/mud-telnet.c (original)
+++ trunk/src/mud-telnet.c Sat Jun 28 05:02:32 2008
@@ -49,23 +49,23 @@
static void mud_telnet_send_iac(MudTelnet *telnet, guchar ch1, guchar ch2);
static void mud_telnet_on_handle_subnego(MudTelnet *telnet);
-static void mud_telnet_on_enable_opt(MudTelnet *telnet,
+static void mud_telnet_on_enable_opt(MudTelnet *telnet,
const guchar opt_no, gint him);
-static void mud_telnet_on_disable_opt(MudTelnet *telnet,
+static void mud_telnet_on_disable_opt(MudTelnet *telnet,
const guchar opt_no, gint him);
static guchar mud_telnet_get_telopt_state(guchar *storage, const guint bitshift);
static gint mud_telnet_get_telopt_queue(guchar *storage, const guint bitshift);
-static void mud_telnet_set_telopt_state(guchar *storage,
+static void mud_telnet_set_telopt_state(guchar *storage,
const enum TelnetOptionState state, const guint bitshift);
static gint mud_telnet_get_index_by_option(MudTelnet *telnet, guchar option_number);
-static void mud_telnet_set_telopt_queue(guchar *storage,
+static void mud_telnet_set_telopt_queue(guchar *storage,
gint bit_on, const guint bitshift);
static gint mud_telnet_handle_positive_nego(MudTelnet *telnet,
const guchar opt_no,
const guchar affirmative,
const guchar negative,
gint him);
-static gint
+static gint
mud_telnet_handle_negative_nego(MudTelnet *telnet,
const guchar opt_no,
const guchar affirmative,
@@ -122,7 +122,7 @@
GObjectClass *parent_class;
telnet = MUD_TELNET(object);
-
+
g_free(telnet->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -136,29 +136,29 @@
mud_telnet_new(MudConnectionView *parent, GConn *connection)
{
MudTelnet *telnet;
-
+
telnet = g_object_new(MUD_TYPE_TELNET, NULL);
-
+
telnet->parent = parent;
telnet->conn = connection;
telnet->tel_state = TEL_STATE_TEXT;
telnet->ttype_iteration = 0;
-
+
memset(telnet->telopt_states, 0, sizeof(telnet->telopt_states));
memset(telnet->handlers, 0, sizeof(telnet->handlers));
-
+
mud_telnet_register_handlers(telnet);
-
+
telnet->eor_enabled = FALSE;
-
- return telnet;
+
+ return telnet;
}
void
mud_telnet_register_handlers(MudTelnet *telnet)
{
gint i;
-
+
for(i = 0; i < TEL_HANDLERS_SIZE; ++i)
{
telnet->handlers[i].type = HANDLER_NONE;
@@ -168,7 +168,7 @@
telnet->handlers[i].disable = NULL;
telnet->handlers[i].handle_sub_neg = NULL;
}
-
+
/* TTYPE */
telnet->handlers[0].type = HANDLER_TTYPE;
telnet->handlers[0].option_number = (guchar)TELOPT_TTYPE;
@@ -176,7 +176,7 @@
telnet->handlers[0].enable = MudHandler_TType_Enable;
telnet->handlers[0].disable = MudHandler_TType_Disable;
telnet->handlers[0].handle_sub_neg = MudHandler_TType_HandleSubNeg;
-
+
/* NAWS */
telnet->handlers[1].type = HANDLER_NAWS;
telnet->handlers[1].option_number = (guchar)TELOPT_NAWS;
@@ -184,7 +184,7 @@
telnet->handlers[1].enable = MudHandler_NAWS_Enable;
telnet->handlers[1].disable = MudHandler_NAWS_Disable;
telnet->handlers[1].handle_sub_neg = MudHandler_NAWS_HandleSubNeg;
-
+
/* ECHO */
telnet->handlers[2].type = HANDLER_ECHO;
telnet->handlers[2].option_number = (guchar)TELOPT_ECHO;
@@ -192,7 +192,7 @@
telnet->handlers[2].enable = MudHandler_ECHO_Enable;
telnet->handlers[2].disable = MudHandler_ECHO_Disable;
telnet->handlers[2].handle_sub_neg = MudHandler_ECHO_HandleSubNeg;
-
+
/* EOR */
telnet->handlers[3].type = HANDLER_EOR;
telnet->handlers[3].option_number = (guchar)TELOPT_EOR;
@@ -200,7 +200,7 @@
telnet->handlers[3].enable = MudHandler_EOR_Enable;
telnet->handlers[3].disable = MudHandler_EOR_Disable;
telnet->handlers[3].handle_sub_neg = MudHandler_EOR_HandleSubNeg;
-
+
/* CHARSET */
telnet->handlers[4].type = HANDLER_CHARSET;
telnet->handlers[4].option_number = (guchar)TELOPT_CHARSET;
@@ -208,7 +208,7 @@
telnet->handlers[4].enable = MudHandler_CHARSET_Enable;
telnet->handlers[4].disable = MudHandler_CHARSET_Disable;
telnet->handlers[4].handle_sub_neg = MudHandler_CHARSET_HandleSubNeg;
-
+
/* ZMP */
telnet->handlers[5].type = HANDLER_ZMP;
telnet->handlers[5].option_number = (guchar)TELOPT_ZMP;
@@ -216,46 +216,46 @@
telnet->handlers[5].enable = MudHandler_ZMP_Enable;
telnet->handlers[5].disable = MudHandler_ZMP_Disable;
telnet->handlers[5].handle_sub_neg = MudHandler_ZMP_HandleSubNeg;
-
+
}
gint
mud_telnet_isenabled(MudTelnet *telnet, guint8 option_number, gint him)
{
gint i;
-
+
for(i = 0; i < TEL_HANDLERS_SIZE; ++i)
if(telnet->handlers[i].type != HANDLER_NONE)
if(option_number == telnet->handlers[i].option_number)
return telnet->handlers[i].enabled;
-
+
return FALSE;
}
-void
+void
mud_telnet_get_parent_size(MudTelnet *telnet, gint *w, gint *h)
{
mud_connection_view_get_term_size(telnet->parent, w, h);
}
-void
+void
mud_telnet_set_parent_naws(MudTelnet *telnet, gint enabled)
{
mud_connection_view_set_naws(telnet->parent, enabled);
}
-void
+void
mud_telnet_set_parent_remote_encode(MudTelnet *telnet, gint enabled, gchar *encoding)
{
telnet->parent->remote_encode = enabled;
-
+
if(enabled)
telnet->parent->remote_encoding = g_strdup(encoding);
else if(telnet->parent->remote_encoding)
g_free(telnet->parent->remote_encoding);
}
-void
+void
mud_telnet_set_local_echo(MudTelnet *telnet, gint enabled)
{
telnet->parent->local_echo = enabled;
@@ -263,19 +263,19 @@
void
mud_telnet_send_naws(MudTelnet *telnet, gint width, gint height)
-{
+{
guchar w1, h1, w0, h0;
-
+
w1 = (width >> 8) & 0xff;
w0 = width & 0xff;
-
+
h1 = (height >> 8) & 0xff;
h0 = height & 0xff;
-
+
mud_telnet_send_sub_req(telnet, 5, (guchar)TELOPT_NAWS, w1, w0, h1, h0);
}
-MudTelnetBuffer
+MudTelnetBuffer
mud_telnet_process(MudTelnet *telnet, guchar * buf, guint32 count)
{
guchar processed[32768];
@@ -314,7 +314,7 @@
case (guchar)TEL_WILL:
telnet->tel_state = TEL_STATE_WILL;
break;
-
+
case (guchar)TEL_NOP:
telnet->tel_state = TEL_STATE_TEXT;
break;
@@ -322,7 +322,7 @@
case (guchar)TEL_GA:
telnet->tel_state = TEL_STATE_TEXT;
break;
-
+
case (guchar)TEL_EOR_BYTE:
telnet->tel_state = TEL_STATE_TEXT;
break;
@@ -344,24 +344,24 @@
break;
case TEL_STATE_DO:
- mud_telnet_handle_positive_nego(telnet, buf[i],
+ mud_telnet_handle_positive_nego(telnet, buf[i],
(guchar)TEL_WILL, (guchar)TEL_WONT, FALSE);
telnet->tel_state = TEL_STATE_TEXT;
case TEL_STATE_WILL:
- mud_telnet_handle_positive_nego(telnet, buf[i],
+ mud_telnet_handle_positive_nego(telnet, buf[i],
(guchar)TEL_DO, (guchar)TEL_DONT, TRUE);
telnet->tel_state = TEL_STATE_TEXT;
break;
case TEL_STATE_DONT:
- mud_telnet_handle_negative_nego(telnet,
+ mud_telnet_handle_negative_nego(telnet,
buf[i], (guchar)TEL_WILL, (guchar)TEL_WONT, FALSE);
telnet->tel_state = TEL_STATE_TEXT;
break;
case TEL_STATE_WONT:
- mud_telnet_handle_negative_nego(telnet,
+ mud_telnet_handle_negative_nego(telnet,
buf[i], (guchar)TEL_DO, (guchar)TEL_DONT, TRUE);
telnet->tel_state = TEL_STATE_TEXT;
break;
@@ -399,7 +399,7 @@
}
else if (buf[i] == (guchar)TEL_SE)
{
- telnet->subreq_buffer[telnet->subreq_pos++] = buf[i];
+ telnet->subreq_buffer[telnet->subreq_pos++] = buf[i];
mud_telnet_on_handle_subnego(telnet);
telnet->tel_state = TEL_STATE_TEXT;
} else {
@@ -410,10 +410,10 @@
break;
}
}
-
+
ret.buffer = processed;
ret.len = pos;
-
+
return ret;
}
@@ -422,7 +422,7 @@
{
GString *string = g_string_new(NULL);
gchar *ret = string->str;
-
+
switch (ch)
{
case TEL_WILL:
@@ -438,18 +438,18 @@
default:
g_string_append_c(string,ch);
}
-
+
g_string_free(string, FALSE);
-
+
return ret;
}
-gchar*
+gchar*
mud_telnet_get_telopt_string(guchar ch)
{
GString *string = g_string_new(NULL);
gchar *ret = string->str;
-
+
switch (ch)
{
case TELOPT_ECHO:
@@ -479,13 +479,13 @@
default:
g_string_append_c(string, ch);
}
-
+
g_string_free(string, FALSE);
-
+
return ret;
}
-void
+void
mud_telnet_send_charset_req(MudTelnet *telnet, gchar *encoding)
{
guchar byte;
@@ -493,10 +493,10 @@
if(!encoding)
return;
-
+
/* Writes IAC SB CHARSET ACCEPTED <charset> IAC SE to server */
byte = (guchar)TEL_IAC;
-
+
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TEL_SB;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
@@ -504,12 +504,12 @@
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TEL_CHARSET_ACCEPT;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
for (i = 0; i < strlen(encoding); ++i)
{
byte = (guchar)encoding[i];
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
if (byte == (guchar)TEL_IAC)
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
@@ -520,7 +520,7 @@
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
-void
+void
mud_telnet_send_sub_req(MudTelnet *telnet, guint32 count, ...)
{
guchar byte;
@@ -529,7 +529,7 @@
va_start(va, count);
byte = (guchar)TEL_IAC;
-
+
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
byte = (guchar)TEL_SB;
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
@@ -538,7 +538,7 @@
{
byte = (guchar)va_arg(va, gint);
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
if (byte == (guchar)TEL_IAC)
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
@@ -551,7 +551,7 @@
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
-void
+void
mud_telnet_send_raw(MudTelnet *telnet, guint32 count, ...)
{
guchar byte;
@@ -563,7 +563,7 @@
{
byte = (guchar)va_arg(va, gint);
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
-
+
if (byte == (guchar)TEL_IAC)
gnet_conn_write(telnet->conn, (gchar *)&byte, 1);
}
@@ -572,14 +572,14 @@
}
/*** Private Methods ***/
-static void
+static void
mud_telnet_send_iac(MudTelnet *telnet, guchar ch1, guchar ch2)
{
guchar buf[3];
buf[0] = (guchar)TEL_IAC;
buf[1] = ch1;
buf[2] = ch2;
-
+
gnet_conn_write(telnet->conn, (gchar *)buf, 3);
}
@@ -587,16 +587,16 @@
mud_telnet_on_handle_subnego(MudTelnet *telnet)
{
int index;
-
- if (telnet->subreq_pos < 1)
+
+ if (telnet->subreq_pos < 1)
return;
-
+
if((index = mud_telnet_get_index_by_option(telnet, telnet->subreq_buffer[0])) == -1)
{
g_warning("Invalid Telnet Option passed: %d", telnet->subreq_buffer[0]);
return;
}
-
+
if (mud_telnet_isenabled(telnet, telnet->subreq_buffer[0], FALSE))
telnet->handlers[index].handle_sub_neg(telnet, telnet->subreq_buffer + 1,
telnet->subreq_pos - 1, &telnet->handlers[index]);
@@ -606,13 +606,13 @@
mud_telnet_on_enable_opt(MudTelnet *telnet, const guchar opt_no, gint him)
{
int index;
-
+
if((index = mud_telnet_get_index_by_option(telnet, opt_no)) == -1)
{
g_warning("Invalid Telnet Option passed: %d", opt_no);
return;
}
-
+
telnet->handlers[index].enable(telnet, &telnet->handlers[index]);
}
@@ -620,7 +620,7 @@
mud_telnet_on_disable_opt(MudTelnet *telnet, const guchar opt_no, gint him)
{
int index;
-
+
if((index = mud_telnet_get_index_by_option(telnet, opt_no)) == -1)
{
g_warning("Invalid Telnet Option passed: %d", opt_no);
@@ -642,7 +642,7 @@
return !!((*storage >> bitshift) & 0x04u);
}
-static void
+static void
mud_telnet_set_telopt_state(guchar *storage, const enum TelnetOptionState state,
const guint bitshift)
{
@@ -666,7 +666,7 @@
{
const guint bitshift = him ? 4 : 0;
guchar * opt = &(telnet->telopt_states[opt_no]);
-
+
switch (mud_telnet_get_telopt_state(opt, bitshift))
{
case TELOPT_STATE_NO:
@@ -723,7 +723,7 @@
}
}
-static gint
+static gint
mud_telnet_handle_negative_nego(MudTelnet *telnet,
const guchar opt_no,
const guchar affirmative,
@@ -732,7 +732,7 @@
{
const guint bitshift = him ? 4 : 0;
guchar * opt = &(telnet->telopt_states[opt_no]);
-
+
switch (mud_telnet_get_telopt_state(opt, bitshift))
{
case TELOPT_STATE_NO:
@@ -774,16 +774,15 @@
}
}
-static gint
+static gint
mud_telnet_get_index_by_option(MudTelnet *telnet, guchar option_number)
{
gint i;
-
+
for(i = 0; i < TEL_HANDLERS_SIZE; i++)
if(telnet->handlers[i].type != HANDLER_NONE)
if(telnet->handlers[i].option_number == option_number)
return i;
-
+
return -1;
}
-
Modified: trunk/src/mud-telnet.h
==============================================================================
--- trunk/src/mud-telnet.h (original)
+++ trunk/src/mud-telnet.h Sat Jun 28 05:02:32 2008
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
/* Code originally from wxMUD. Converted to a GObject by Les Harris.
* wxMUD - an open source cross-platform MUD client.
* Copyright (C) 2003-2008 Mart Raudsepp
@@ -81,7 +81,7 @@
typedef void(*MudTelnetOnEnableFunc)(MudTelnet *telnet, MudTelnetHandler *handler);
typedef void(*MudTelnetOnDisableFunc)(MudTelnet *telnet, MudTelnetHandler *handler);
-typedef void(*MudTelnetOnHandleSubNegFunc)(MudTelnet *telnet,
+typedef void(*MudTelnetOnHandleSubNegFunc)(MudTelnet *telnet,
guchar *buf, guint len, MudTelnetHandler *handler);
enum TelnetState
@@ -130,11 +130,11 @@
{
enum TelnetHandlerType type;
guchar option_number;
-
+
gint enabled;
-
+
MudTelnet *instance;
-
+
MudTelnetOnEnableFunc enable;
MudTelnetOnDisableFunc disable;
MudTelnetOnHandleSubNegFunc handle_sub_neg;
@@ -146,22 +146,22 @@
struct _MudTelnet
{
GObject parent_instance;
-
+
MudTelnetPrivate *priv;
-
+
enum TelnetState tel_state;
guchar subreq_buffer[TEL_SUBREQ_BUFFER_SIZE];
guint32 subreq_pos;
-
+
guchar telopt_states[256];
gint eor_enabled;
gint ttype_iteration;
-
+
GConn *conn;
MudConnectionView *parent;
MudTelnetHandler handlers[TEL_HANDLERS_SIZE];
-
+
GHashTable *zmp_commands;
MudZMPCommand commands[2048];
};
Modified: trunk/src/mud-window-mconnect.c
==============================================================================
--- trunk/src/mud-window-mconnect.c (original)
+++ trunk/src/mud-window-mconnect.c Sat Jun 28 05:02:32 2008
@@ -44,11 +44,11 @@
gchar *SelChar;
gchar *SelConnect;
gint SelPort;
-
+
GtkWidget *dialog;
GtkWidget *mudView;
-
+
GtkWidget *btnConnect;
GtkWidget *btnClose;
@@ -64,7 +64,7 @@
MudWindow *window;
GtkWidget *winwidget;
-
+
MudTray *tray;
};
@@ -125,13 +125,13 @@
GladeXML *glade;
mconnect->priv = g_new0(MudMConnectWindowPrivate, 1);
-
+
glade = glade_xml_new(GLADEDIR "/connect.glade", "main_connect", NULL);
-
+
mconnect->priv->dialog = glade_xml_get_widget(glade, "main_connect");
-
+
mconnect->priv->mudView = glade_xml_get_widget(glade, "mudView");
-
+
mconnect->priv->btnConnect = glade_xml_get_widget(glade, "btnConnect");
mconnect->priv->btnClose = glade_xml_get_widget(glade, "btnClose");
@@ -145,19 +145,19 @@
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(mconnect->priv->profileCombo), mconnect->priv->comborender, "text", 0, NULL);
mud_mconnect_populate_profiles(mconnect);
-
+
mconnect->priv->store = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(mconnect->priv->mudView), GTK_TREE_MODEL(mconnect->priv->store));
-
+
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(mconnect->priv->mudView), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mconnect->priv->mudView), FALSE);
mconnect->priv->col = gtk_tree_view_column_new();
-
+
gtk_tree_view_append_column(GTK_TREE_VIEW(mconnect->priv->mudView), mconnect->priv->col);
mconnect->priv->renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(mconnect->priv->col, mconnect->priv->renderer, TRUE);
gtk_tree_view_column_add_attribute(mconnect->priv->col, mconnect->priv->renderer, "text", NAME_COLUMN);
-
+
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(mconnect->priv->mudView)), mud_mconnect_select_cb, mconnect, NULL);
mud_mconnect_window_populate_treeview(mconnect);
@@ -166,7 +166,7 @@
g_signal_connect(G_OBJECT(mconnect->priv->btnClose), "clicked", G_CALLBACK(mud_mconnect_window_close_cb), mconnect);
gtk_window_resize(GTK_WINDOW(mconnect->priv->dialog), 400,200);
-
+
gtk_widget_show_all(mconnect->priv->dialog);
gtk_window_set_destroy_with_parent(GTK_WINDOW(mconnect->priv->dialog), TRUE);
gtk_window_present(GTK_WINDOW(mconnect->priv->dialog));
@@ -189,14 +189,14 @@
GObjectClass *parent_class;
MudMConnect = MUD_MCONNECT_WINDOW(object);
-
+
g_free(MudMConnect->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
parent_class->finalize(object);
}
-void
+void
mud_mconnect_populate_profiles(MudMConnectWindow *mconnect)
{
GSList *profiles, *entry;
@@ -206,9 +206,9 @@
GtkTreeIter iter;
client = gconf_client_get_default();
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/list");
-
+
profiles = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
for (entry = profiles; entry != NULL; entry = g_slist_next(entry))
{
@@ -228,33 +228,33 @@
GError *error = NULL;
gchar keyname[2048];
int show;
-
+
gtk_tree_store_clear(store);
-
+
client = gconf_client_get_default();
-
+
muds = gconf_client_get_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, &error);
gtk_widget_set_sensitive(mconnect->priv->btnConnect,FALSE);
-
+
for (entry = muds; entry != NULL; entry = g_slist_next(entry))
{
mname = g_strdup((gchar *) entry->data);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/show", mname);
-
+
show = gconf_client_get_int(client, keyname, &error);
if(show)
{
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/name", mname);
-
+
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter, NAME_COLUMN, gconf_client_get_string(client, keyname, &error), -1);
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/list", mname);
chars = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
-
+
for(centry = chars; centry != NULL; centry = g_slist_next(centry))
{
gtk_tree_store_append(store, &child, &iter);
@@ -263,19 +263,19 @@
}
g_free(mname);
- }
+ }
}
// MudMConnectWindow Callbacks
-void
+void
mud_mconnect_window_connect_cb(GtkWidget *widget, MudMConnectWindow *mconnect)
{
if(mconnect->priv->SelPort < 1)
mconnect->priv->SelPort = 23;
-
+
mud_tray_update_icon(mconnect->priv->tray, offline);
-
+
mconnect->priv->view = mud_connection_view_new("Default", mconnect->priv->SelHost, mconnect->priv->SelPort, mconnect->priv->winwidget, (GtkWidget *)mconnect->priv->tray, mconnect->priv->CurrSelMud);
-
+
mud_window_add_connection_view(mconnect->priv->window, mconnect->priv->view, mconnect->priv->CurrSelMud);
mud_connection_view_set_profile(mconnect->priv->view, get_profile((const gchar *)mud_profile_from_number(gtk_combo_box_get_active(GTK_COMBO_BOX(mconnect->priv->profileCombo)))));
@@ -289,13 +289,13 @@
gtk_widget_destroy(mconnect->priv->dialog);
}
-void
+void
mud_mconnect_window_close_cb(GtkWidget *widget, MudMConnectWindow *mconnect)
{
gtk_widget_destroy(mconnect->priv->dialog);
}
-gboolean
+gboolean
mud_mconnect_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
@@ -310,29 +310,29 @@
gchar keyname[2048];
gchar *name = NULL;
-
+
client = gconf_client_get_default();
mconnect->priv->SelChar = NULL;
mconnect->priv->SelConnect = NULL;
-
- if (gtk_tree_model_get_iter(model, &iter, path))
- {
+
+ if (gtk_tree_model_get_iter(model, &iter, path))
+ {
gtk_tree_model_get(model, &iter, 0, &mconnect->priv->CurrSelRowText, -1);
-
+
mconnect->priv->CurrSelRow = (gtk_tree_path_get_indices(path))[0];
- mconnect->priv->CurrIterStr = gtk_tree_model_get_string_from_iter(model, &iter);
-
+ mconnect->priv->CurrIterStr = gtk_tree_model_get_string_from_iter(model, &iter);
+
apath = gtk_tree_path_new_from_indices(mconnect->priv->CurrSelRow,-1);
-
+
gtk_tree_model_get_iter(model, &top, apath);
gtk_tree_model_get(model, &top, 0, &mconnect->priv->CurrSelMud,-1);
-
+
name = remove_whitespace(mconnect->priv->CurrSelMud);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/host", name);
mconnect->priv->SelHost = gconf_client_get_string(client, keyname, &error);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/port",name);
mconnect->priv->SelPort = gconf_client_get_int(client, keyname, &error);
if(strcmp(mconnect->priv->CurrSelRowText,mconnect->priv->CurrSelMud) != 0)
@@ -341,15 +341,15 @@
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/%s/connect", name, mconnect->priv->SelChar);
mconnect->priv->SelConnect = gconf_client_get_string(client, keyname, &error);
}
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/profile", name);
gtk_combo_box_set_active(GTK_COMBO_BOX(mconnect->priv->profileCombo),gconf_client_get_int(client, keyname, &error));
gtk_widget_set_sensitive(mconnect->priv->btnConnect,TRUE);
-
+
g_free(name);
}
-
+
return TRUE;
}
@@ -358,12 +358,12 @@
mud_window_mconnect_new(MudWindow *win, GtkWidget *winwidget, MudTray *tray)
{
MudMConnectWindow *MudMConnect;
-
+
MudMConnect = g_object_new(MUD_TYPE_MCONNECT_WINDOW, NULL);
MudMConnect->priv->window = win;
MudMConnect->priv->winwidget = winwidget;
MudMConnect->priv->tray = tray;
-
- return MudMConnect;
+
+ return MudMConnect;
}
Modified: trunk/src/mud-window-mconnect.h
==============================================================================
--- trunk/src/mud-window-mconnect.h (original)
+++ trunk/src/mud-window-mconnect.h Sat Jun 28 05:02:32 2008
@@ -19,7 +19,7 @@
struct _MudMConnectWindow
{
GObject parent_instance;
-
+
MudMConnectWindowPrivate *priv;
};
Modified: trunk/src/mud-window-mudedit.c
==============================================================================
--- trunk/src/mud-window-mudedit.c (original)
+++ trunk/src/mud-window-mudedit.c Sat Jun 28 05:02:32 2008
@@ -48,9 +48,9 @@
gchar *CurrSelRowText;
gchar *CurrSelMud;
gchar *CurrIterStr;
-
+
GtkWidget *dialog;
-
+
GtkWidget *btnAdd;
GtkWidget *btnProps;
GtkWidget *btnCancel;
@@ -141,7 +141,7 @@
mudedit->priv->mud = g_strdup(remove_whitespace(gmud));
g_free(gmud);
-
+
mud_edit_window_query_glade(mudedit);
populate_profiles(mudedit);
mud_edit_window_connect_signals(mudedit);
@@ -149,7 +149,7 @@
mudedit->priv->CharStore = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(mudedit->priv->CharView), GTK_TREE_MODEL(mudedit->priv->CharStore));
-
+
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(mudedit->priv->CharView), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mudedit->priv->CharView), FALSE);
mudedit->priv->col = gtk_tree_view_column_new();
@@ -158,11 +158,11 @@
mudedit->priv->renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(mudedit->priv->col, mudedit->priv->renderer, TRUE);
gtk_tree_view_column_add_attribute(mudedit->priv->col, mudedit->priv->renderer, "text", NAME_COLUMN);
-
+
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(mudedit->priv->CharView)), mud_edit_window_tree_select_cb, mudedit, NULL);
-
+
populate_charview(mudedit);
-
+
gtk_widget_show_all(mudedit->priv->dialog);
gtk_window_set_destroy_with_parent(GTK_WINDOW(mudedit->priv->dialog), TRUE);
gtk_window_present(GTK_WINDOW(mudedit->priv->dialog));
@@ -183,7 +183,7 @@
GObjectClass *parent_class;
mudedit = MUD_EDIT_WINDOW(object);
-
+
g_free(mudedit->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -191,7 +191,7 @@
}
// MudEditWindow Utility Functions
-void
+void
mud_edit_window_query_gconf(MudEditWindow *mudedit)
{
GConfClient *client;
@@ -233,7 +233,7 @@
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/desc", mudedit->priv->mud);
desc = gconf_client_get_string(client, keyname, &error);
- if(desc)
+ if(desc)
{
gtk_text_buffer_set_text(buffer, desc, strlen(desc));
g_free(desc);
@@ -249,14 +249,14 @@
}
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/codebase", mudedit->priv->mud);
- gtk_combo_box_set_active(GTK_COMBO_BOX(mudedit->priv->MudCodeBaseCombo), gconf_client_get_int(client, keyname, &error));
+ gtk_combo_box_set_active(GTK_COMBO_BOX(mudedit->priv->MudCodeBaseCombo), gconf_client_get_int(client, keyname, &error));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/profile", mudedit->priv->mud);
gtk_combo_box_set_active(GTK_COMBO_BOX(mudedit->priv->MudProfileCombo), gconf_client_get_int(client, keyname, &error));
-
+
}
-void
+void
mud_edit_window_connect_signals(MudEditWindow *mudedit)
{
g_signal_connect(G_OBJECT(mudedit->priv->btnProps), "clicked", G_CALLBACK(mud_edit_window_props_cb), mudedit);
@@ -266,13 +266,13 @@
g_signal_connect(G_OBJECT(mudedit->priv->btnDel), "clicked", G_CALLBACK(mud_edit_window_del_cb), mudedit);
}
-void
+void
mud_edit_window_query_glade(MudEditWindow *mudedit)
{
GladeXML *glade;
glade = glade_xml_new(GLADEDIR "/muds.glade", "mudedit_window", NULL);
-
+
mudedit->priv->dialog = glade_xml_get_widget(glade, "mudedit_window");
mudedit->priv->btnAdd = glade_xml_get_widget(glade, "btnAdd");
@@ -291,16 +291,16 @@
mudedit->priv->comborender =gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(mudedit->priv->MudProfileCombo), mudedit->priv->comborender, TRUE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(mudedit->priv->MudProfileCombo), mudedit->priv->comborender, "text", 0, NULL);
-
+
mudedit->priv->EntryName = glade_xml_get_widget(glade, "EntryName");
mudedit->priv->EntryHost = glade_xml_get_widget(glade, "EntryHost");
mudedit->priv->EntryPort = glade_xml_get_widget(glade, "EntryPort");
mudedit->priv->EntryTheme = glade_xml_get_widget(glade, "EntryTheme");
mudedit->priv->MudDescTextView = glade_xml_get_widget(glade, "MudDescTextView");
-
+
mudedit->priv->CharView = glade_xml_get_widget(glade, "CharView");
-
+
g_object_unref(glade);
}
@@ -326,26 +326,26 @@
client = gconf_client_get_default();
strval = gconf_value_new(GCONF_VALUE_STRING);
res = NULL;
-
+
chars = NULL;
mudname = remove_whitespace((gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryName)));
-
+
g_free(mudedit->priv->mud);
-
+
mudedit->priv->mud = g_strdup(mudname);
-
+
glade = glade_xml_new(GLADEDIR "/muds.glade", "charprops_window", NULL);
dialog = glade_xml_get_widget(glade, "charprops_window");
name = glade_xml_get_widget(glade, "CharNameEntry");
connectString = glade_xml_get_widget(glade, "CharConnectStrTextView");
-
+
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(connectString));
-
+
if(charname != NULL) {
gtk_entry_set_text(GTK_ENTRY(name), charname);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/%s/connect", mudname, charname);
connect = gconf_client_get_string(client, keyname, &error);
if(connect)
@@ -370,9 +370,9 @@
{
chars = g_slist_append(chars, (void *)g_strdup(namestr));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/list", mudname);
- gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
+ gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
}
-
+
if(strcmp(namestr, charname) != 0 && !NewChar)
{
for (entry = chars; entry != NULL; entry = g_slist_next(entry))
@@ -382,20 +382,20 @@
entry->data = (void *)g_strdup(namestr);
}
}
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/list", mudname);
- gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
+ gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
}
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/%s/connect", mudname, namestr);
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer, &start, &end, FALSE));
- gconf_client_set(client, keyname, strval, &error);
+ gconf_client_set(client, keyname, strval, &error);
}
-
+
gconf_value_free(strval);
gtk_widget_destroy(dialog);
g_object_unref(glade);
@@ -403,7 +403,7 @@
populate_charview(mudedit);
}
-void
+void
populate_charview(MudEditWindow *mudedit)
{
GtkTreeStore* store = GTK_TREE_STORE(mudedit->priv->CharStore);
@@ -412,12 +412,12 @@
GError *error=NULL;
gchar *cname;
char keyname[2048];
-
+
gtk_tree_store_clear(store);
-
+
gtk_widget_set_sensitive(mudedit->priv->btnProps, FALSE);
gtk_widget_set_sensitive(mudedit->priv->btnDel, FALSE);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/list", mudedit->priv->mud);
chars = gconf_client_get_list(gconf_client_get_default(), keyname, GCONF_VALUE_STRING, &error);
@@ -430,7 +430,7 @@
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter, NAME_COLUMN, cname, -1);
g_free(cname);
- }
+ }
}
void
@@ -443,9 +443,9 @@
GtkTreeIter iter;
client = gconf_client_get_default();
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/list");
-
+
profiles = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
for (entry = profiles; entry != NULL; entry = g_slist_next(entry))
{
@@ -455,19 +455,19 @@
}
// MudEditWindow Callbacks
-void
+void
mud_edit_window_props_cb(GtkWidget *widget, MudEditWindow *mudedit)
{
props_window_dialog(mudedit->priv->CurrSelRowText, mudedit, FALSE);
}
-void
+void
mud_edit_window_add_cb(GtkWidget *widget, MudEditWindow *mudedit)
{
props_window_dialog(NULL, mudedit, TRUE);
}
-void
+void
mud_edit_window_ok_cb(GtkWidget *widget, MudEditWindow *mudedit)
{
gchar *name;
@@ -480,26 +480,26 @@
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mudedit->priv->MudDescTextView));
GtkTextIter start, end;
gint profileInt;
-
+
client = gconf_client_get_default();
strval = gconf_value_new(GCONF_VALUE_STRING);
intval = gconf_value_new(GCONF_VALUE_INT);
-
+
name = remove_whitespace((gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryName)));
-
+
/* Add the mud name to the list if new */
if(gNewMud)
{
muds = gconf_client_get_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, NULL);
muds = g_slist_append(muds, (void *)name);
- gconf_client_set_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, muds, &error);
+ gconf_client_set_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, muds, &error);
}
-
+
/* Changing the name of a MUD entry requires some extra maintenance */
if(strcmp(mudedit->priv->mud,name) != 0)
{
gconf_value_set_string(strval, (gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryName)));
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/name",name);
gconf_client_set(client, keyname, strval, &error);
@@ -517,7 +517,7 @@
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/name", name);
gconf_client_set(client, keyname, strval, &error);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s", mudedit->priv->mud);
g_free(mudedit->priv->mud);
mudedit->priv->mud = g_strdup(name);
@@ -529,7 +529,7 @@
gconf_value_set_string(strval, (gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryName)));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/name", mudedit->priv->mud);
gconf_client_set(client, keyname, strval, &error);
-
+
gconf_value_set_string(strval, (gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryHost)));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/host", mudedit->priv->mud);
gconf_client_set(client, keyname, strval, &error);
@@ -537,14 +537,14 @@
gconf_value_set_int(intval, atoi((gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryPort))));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/port", mudedit->priv->mud);
gconf_client_set(client, keyname, intval, &error);
-
+
gconf_value_set_int(intval, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mudedit->priv->btnShowToggle)));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/show", mudedit->priv->mud);
gconf_client_set(client, keyname, intval, &error);
-
+
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
-
+
gconf_value_set_string(strval, gtk_text_buffer_get_text(buffer, &start, &end, FALSE));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/desc", mudedit->priv->mud);
gconf_client_set(client, keyname, strval, &error);
@@ -552,7 +552,7 @@
gconf_value_set_string(strval, (gchar *)gtk_entry_get_text(GTK_ENTRY(mudedit->priv->EntryTheme)));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/theme", mudedit->priv->mud);
gconf_client_set(client, keyname, strval, &error);
-
+
gconf_value_set_int(intval, gtk_combo_box_get_active(GTK_COMBO_BOX(mudedit->priv->MudCodeBaseCombo)));
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/codebase", mudedit->priv->mud);
gconf_client_set(client, keyname, intval, &error);
@@ -561,45 +561,45 @@
profileInt = 0;
else
profileInt = gtk_combo_box_get_active(GTK_COMBO_BOX(mudedit->priv->MudProfileCombo));
-
+
gconf_value_set_int(intval, profileInt);
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/profile", mudedit->priv->mud);
gconf_client_set(client, keyname, intval, &error);
-
+
gconf_value_free(strval);
gconf_value_free(intval);
-
- mud_list_window_populate_treeview(gParent);
+
+ mud_list_window_populate_treeview(gParent);
gtk_widget_destroy(mudedit->priv->dialog);
}
-void
+void
mud_edit_window_cancel_cb(GtkWidget *widget, MudEditWindow *mudedit)
{
gtk_widget_destroy(mudedit->priv->dialog);
}
-gboolean
+gboolean
mud_edit_window_tree_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
- gpointer userdata)
+ gpointer userdata)
{
GtkTreeIter iter;
MudEditWindow *mudedit = (MudEditWindow *)userdata;
- if (gtk_tree_model_get_iter(model, &iter, path))
- {
+ if (gtk_tree_model_get_iter(model, &iter, path))
+ {
gtk_tree_model_get(model, &iter, 0, &mudedit->priv->CurrSelRowText, -1);
-
+
mudedit->priv->CurrSelRow = (gtk_tree_path_get_indices(path))[0];
mudedit->priv->CurrIterStr = gtk_tree_model_get_string_from_iter(model, &iter);
gtk_widget_set_sensitive(mudedit->priv->btnProps, TRUE);
- gtk_widget_set_sensitive(mudedit->priv->btnDel, TRUE);
+ gtk_widget_set_sensitive(mudedit->priv->btnDel, TRUE);
}
-
+
return TRUE;
}
@@ -610,13 +610,13 @@
GConfClient *client;
GError *error = NULL;
char keyname[2048];
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
client = gconf_client_get_default();
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/list", mudedit->priv->mud);
-
+
chars = gconf_client_get_list(client, keyname, GCONF_VALUE_STRING, &error);
for (entry = chars; entry != NULL; entry = g_slist_next(entry))
@@ -626,17 +626,17 @@
rementry->data = entry->data;
}
}
-
-
+
+
chars = g_slist_remove(chars, rementry->data);
-
- gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
- if(!chars)
+
+ gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, chars, &error);
+ if(!chars)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mudedit->priv->btnShowToggle), FALSE);
gtk_widget_set_sensitive(mudedit->priv->btnShowToggle, TRUE);
}
-
+
populate_charview(mudedit);
}
@@ -651,5 +651,5 @@
gParent = mudlist;
mudedit = g_object_new(MUD_TYPE_EDIT_WINDOW, NULL);
- return mudedit;
+ return mudedit;
}
Modified: trunk/src/mud-window-mudedit.h
==============================================================================
--- trunk/src/mud-window-mudedit.h (original)
+++ trunk/src/mud-window-mudedit.h Sat Jun 28 05:02:32 2008
@@ -19,7 +19,7 @@
struct _MudEditWindow
{
GObject parent_instance;
-
+
MudEditWindowPrivate *priv;
};
Modified: trunk/src/mud-window-mudlist.c
==============================================================================
--- trunk/src/mud-window-mudlist.c (original)
+++ trunk/src/mud-window-mudlist.c Sat Jun 28 05:02:32 2008
@@ -40,17 +40,17 @@
gchar *CurrSelRowText;
gchar *CurrSelMud;
gchar *CurrIterStr;
-
+
GtkWidget *dialog;
-
+
GtkWidget *btnAdd;
GtkWidget *btnEdit;
GtkWidget *btnDel;
GtkWidget *btnClose;
-
+
GtkWidget *MudListTreeView;
GtkWidget *MudDetailTextView;
-
+
GtkTreeStore *MudListTreeStore;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
@@ -113,10 +113,10 @@
GladeXML *glade;
mudlist->priv = g_new0(MudListWindowPrivate, 1);
-
+
mudlist->priv->mudList = NULL;
mudlist->priv->CurrSelRow = -1; // Nothing selected.
-
+
glade = glade_xml_new(GLADEDIR "/muds.glade", "mudlist_window", NULL);
mudlist->priv->dialog = glade_xml_get_widget(glade, "mudlist_window");
mudlist->priv->btnAdd = glade_xml_get_widget(glade, "btnAdd");
@@ -125,31 +125,31 @@
mudlist->priv->btnClose = glade_xml_get_widget(glade, "btnClose");
mudlist->priv->MudListTreeView = glade_xml_get_widget(glade, "MudListTreeView");
mudlist->priv->MudDetailTextView = glade_xml_get_widget(glade, "MudDetailTextView");
-
+
g_signal_connect(G_OBJECT(mudlist->priv->btnAdd), "clicked", G_CALLBACK(mud_list_window_add_cb), mudlist);
g_signal_connect(G_OBJECT(mudlist->priv->btnEdit), "clicked", G_CALLBACK(mud_list_window_edit_cb), mudlist);
g_signal_connect(G_OBJECT(mudlist->priv->btnDel), "clicked", G_CALLBACK(mud_list_window_del_cb), mudlist);
- g_signal_connect(G_OBJECT(mudlist->priv->btnClose), "clicked", G_CALLBACK(mud_list_window_close_cb), mudlist);
-
+ g_signal_connect(G_OBJECT(mudlist->priv->btnClose), "clicked", G_CALLBACK(mud_list_window_close_cb), mudlist);
+
/* I hate GtkTreeView and its loathsome ilk */
mudlist->priv->MudListTreeStore = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(mudlist->priv->MudListTreeView), GTK_TREE_MODEL(mudlist->priv->MudListTreeStore));
-
+
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(mudlist->priv->MudListTreeView), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mudlist->priv->MudListTreeView), FALSE);
mudlist->priv->col = gtk_tree_view_column_new();
-
+
gtk_tree_view_append_column(GTK_TREE_VIEW(mudlist->priv->MudListTreeView), mudlist->priv->col);
mudlist->priv->renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(mudlist->priv->col, mudlist->priv->renderer, TRUE);
gtk_tree_view_column_add_attribute(mudlist->priv->col, mudlist->priv->renderer, "text", NAME_COLUMN);
-
+
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(mudlist->priv->MudListTreeView)), mud_list_window_tree_select_cb, mudlist, NULL);
-
+
mud_list_window_populate_treeview(mudlist);
-
+
gtk_window_resize(GTK_WINDOW(mudlist->priv->dialog), 400,200);
-
+
gtk_widget_show_all(mudlist->priv->dialog);
gtk_window_set_destroy_with_parent(GTK_WINDOW(mudlist->priv->dialog), TRUE);
gtk_window_present(GTK_WINDOW(mudlist->priv->dialog));
@@ -172,14 +172,14 @@
GObjectClass *parent_class;
mudlist = MUD_LIST_WINDOW(object);
-
+
g_free(mudlist->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
parent_class->finalize(object);
}
-void
+void
mud_list_window_populate_treeview(MudListWindow *mudlist)
{
GtkTreeStore* store = GTK_TREE_STORE(mudlist->priv->MudListTreeStore);
@@ -190,43 +190,43 @@
GConfClient *client;
GError *error = NULL;
gchar keyname[2048];
-
+
client = gconf_client_get_default();
gtk_tree_store_clear(store);
-
+
gtk_widget_set_sensitive(mudlist->priv->btnEdit, FALSE);
gtk_widget_set_sensitive(mudlist->priv->btnDel, FALSE);
-
+
gtk_text_buffer_set_text(buffer, "", 0);
-
+
muds = gconf_client_get_list(gconf_client_get_default(), "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, NULL);
for (entry = muds; entry != NULL; entry = g_slist_next(entry))
{
mname = g_strdup((gchar *) entry->data);
-
+
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/name", mname);
-
+
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter, NAME_COLUMN, gconf_client_get_string(client, keyname, &error), -1);
g_free(mname);
- }
+ }
g_slist_free(muds);
}
// Mudlist Callbacks
-void
+void
mud_list_window_add_cb(GtkWidget *widget, MudListWindow *mudlist)
{
gchar name[1024];
g_snprintf(name, 1024, "New MUD %d", gtk_tree_model_iter_n_children(GTK_TREE_MODEL(mudlist->priv->MudListTreeStore),NULL) + 1);
-
+
mud_window_mudedit_new(name, mudlist,TRUE);
}
-void
+void
mud_list_window_edit_cb(GtkWidget *widget, MudListWindow *mudlist)
{
mud_window_mudedit_new(mudlist->priv->CurrSelRowText, mudlist, FALSE);
@@ -238,12 +238,12 @@
GSList *muds, *entry, *rementry;
GConfClient *client;
GError *error = NULL;
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
client = gconf_client_get_default();
-
+
muds = gconf_client_get_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, &error);
for (entry = muds; entry != NULL; entry = g_slist_next(entry))
@@ -253,28 +253,28 @@
rementry->data = entry->data;
}
}
-
-
+
+
muds = g_slist_remove(muds, rementry->data);
-
- gconf_client_set_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, muds, &error);
-
- mud_list_window_populate_treeview(mudlist);
+
+ gconf_client_set_list(client, "/apps/gnome-mud/muds/list", GCONF_VALUE_STRING, muds, &error);
+
+ mud_list_window_populate_treeview(mudlist);
}
-void
+void
mud_list_window_close_cb(GtkWidget *widget, MudListWindow *mudlist)
{
gtk_widget_destroy(mudlist->priv->dialog);
mud_list_window_finalize(G_OBJECT(mudlist));
}
-gboolean
+gboolean
mud_list_window_tree_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
- gpointer userdata)
+ gpointer userdata)
{
GtkTreeIter iter;
MudListWindow *mudlist = (MudListWindow *)userdata;
@@ -285,13 +285,13 @@
GError *error = NULL;
gtk_text_buffer_set_text(buffer, "", 0);
-
- if (gtk_tree_model_get_iter(model, &iter, path))
+
+ if (gtk_tree_model_get_iter(model, &iter, path))
{
client = gconf_client_get_default();
-
+
gtk_tree_model_get(model, &iter, 0, &mudlist->priv->CurrSelRowText, -1);
-
+
mudlist->priv->CurrSelRow = (gtk_tree_path_get_indices(path))[0];
mudlist->priv->CurrIterStr = gtk_tree_model_get_string_from_iter(model, &iter);
@@ -299,16 +299,16 @@
gtk_widget_set_sensitive(mudlist->priv->btnDel, TRUE);
g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/desc", remove_whitespace(mudlist->priv->CurrSelRowText));
-
+
desc = gconf_client_get_string(client, keyname, &error);
if(desc)
{
gtk_text_buffer_set_text(buffer, desc, strlen(desc));
- g_free(desc);
+ g_free(desc);
}
-
+
}
-
+
return TRUE;
}
@@ -320,5 +320,5 @@
mudlist = g_object_new(MUD_TYPE_LIST_WINDOW, NULL);
- return mudlist;
+ return mudlist;
}
Modified: trunk/src/mud-window-profile.c
==============================================================================
--- trunk/src/mud-window-profile.c (original)
+++ trunk/src/mud-window-profile.c Sat Jun 28 05:02:32 2008
@@ -34,17 +34,17 @@
struct _MudProfileWindowPrivate
{
MudWindow *window;
-
+
GtkWidget *dialog;
GtkWidget *treeview;
-
+
GtkWidget *btnAdd;
GtkWidget *btnDelete;
GtkWidget *btnClose;
-
+
gint CurrSelRow;
gchar *CurrSelRowText;
-
+
GtkTreeStore *treestore;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
@@ -108,7 +108,7 @@
GladeXML *glade;
profwin->priv = g_new0(MudProfileWindowPrivate, 1);
-
+
glade = glade_xml_new(GLADEDIR "/prefs.glade", "profiles_window", NULL);
profwin->priv->dialog = glade_xml_get_widget(glade, "profiles_window");
@@ -116,35 +116,35 @@
profwin->priv->btnAdd = glade_xml_get_widget(glade, "btnAdd");
profwin->priv->btnDelete = glade_xml_get_widget(glade, "btnDelete");
profwin->priv->btnClose = glade_xml_get_widget(glade, "btnClose");
-
+
profwin->priv->treeview = glade_xml_get_widget(glade, "profilesView");
profwin->priv->treestore = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(profwin->priv->treeview), GTK_TREE_MODEL(profwin->priv->treestore));
-
+
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(profwin->priv->treeview), TRUE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(profwin->priv->treeview), FALSE);
profwin->priv->col = gtk_tree_view_column_new();
-
+
gtk_tree_view_append_column(GTK_TREE_VIEW(profwin->priv->treeview), profwin->priv->col);
profwin->priv->renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(profwin->priv->col, profwin->priv->renderer, TRUE);
gtk_tree_view_column_add_attribute(profwin->priv->col, profwin->priv->renderer, "text", NAME_COLUMN);
-
+
gtk_tree_selection_set_select_function(gtk_tree_view_get_selection(GTK_TREE_VIEW(profwin->priv->treeview)), mud_profile_window_tree_select_cb, profwin, NULL);
-
+
mud_profile_window_populate_treeview(profwin);
g_signal_connect(G_OBJECT(profwin->priv->btnClose), "clicked", G_CALLBACK(mud_profile_window_close_cb), profwin);
g_signal_connect(G_OBJECT(profwin->priv->btnAdd), "clicked", G_CALLBACK(mud_profile_window_add_cb), profwin);
g_signal_connect(G_OBJECT(profwin->priv->btnDelete), "clicked", G_CALLBACK(mud_profile_window_del_cb), profwin);
-
+
gtk_widget_show_all(profwin->priv->dialog);
gtk_window_set_destroy_with_parent(GTK_WINDOW(profwin->priv->dialog), TRUE);
gtk_window_present(GTK_WINDOW(profwin->priv->dialog));
gtk_window_resize(GTK_WINDOW(profwin->priv->dialog), 300,300);
-
+
g_object_unref(glade);
}
@@ -163,7 +163,7 @@
GObjectClass *parent_class;
profwin = MUD_PROFILE_WINDOW(object);
-
+
g_free(profwin->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -171,7 +171,7 @@
}
// MudProfileWindow Callbacks
-void
+void
mud_profile_window_add_cb(GtkWidget *widget, MudProfileWindow *profwin)
{
GladeXML *glade;
@@ -183,17 +183,17 @@
glade = glade_xml_new(GLADEDIR "/prefs.glade", "newprofile_dialog", NULL);
dialog = glade_xml_get_widget(glade, "newprofile_dialog");
-
+
entry_profile = glade_xml_get_widget(glade, "entry_profile");
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_OK)
{
profile = remove_whitespace((gchar *)gtk_entry_get_text(GTK_ENTRY(entry_profile)));
-
+
def = get_profile("Default");
prof = mud_profile_new((const gchar *)profile);
-
+
mud_profile_copy_preferences(def, prof);
mud_profile_window_populate_treeview(profwin);
@@ -204,7 +204,7 @@
g_object_unref(glade);
}
-void
+void
mud_profile_window_del_cb(GtkWidget *widget, MudProfileWindow *profwin)
{
@@ -217,14 +217,14 @@
}
}
-void
+void
mud_profile_window_close_cb(GtkWidget *widget, MudProfileWindow *profwin)
{
gtk_widget_destroy(profwin->priv->dialog);
g_object_unref(profwin);
}
-gboolean
+gboolean
mud_profile_window_tree_select_cb(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
@@ -234,21 +234,21 @@
GtkTreeIter iter;
MudProfileWindow *profwin = (MudProfileWindow *)userdata;
- if (gtk_tree_model_get_iter(model, &iter, path))
+ if (gtk_tree_model_get_iter(model, &iter, path))
{
gtk_tree_model_get(model, &iter, 0, &profwin->priv->CurrSelRowText, -1);
-
+
profwin->priv->CurrSelRow = (gtk_tree_path_get_indices(path))[0];
gtk_widget_set_sensitive(profwin->priv->btnDelete, TRUE);
-
+
}
-
+
return TRUE;
}
// MudProfileWindow Util Functions
-void
+void
mud_profile_window_populate_treeview(MudProfileWindow *profwin)
{
const GList *profiles;
@@ -257,16 +257,16 @@
GtkTreeIter iter;
gtk_tree_store_clear(store);
-
+
gtk_widget_set_sensitive(profwin->priv->btnDelete, FALSE);
profiles = mud_profile_get_profiles();
-
+
for (entry = (GList *)profiles; entry != NULL; entry = g_list_next(entry))
{
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter, NAME_COLUMN,(gchar *)MUD_PROFILE(entry->data)->name, -1);
- }
+ }
}
// Instantiate MudProfileWindow
@@ -279,5 +279,5 @@
profwin->priv->window = window;
- return profwin;
+ return profwin;
}
Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c (original)
+++ trunk/src/mud-window.c Sat Jun 28 05:02:32 2008
@@ -60,7 +60,7 @@
GConfClient *gconf_client;
GSList *mud_views_list;
-
+
GtkWidget *window;
GtkWidget *notebook;
GtkWidget *textview;
@@ -74,7 +74,7 @@
GtkWidget *current_view;
GtkWidget *mi_profiles;
-
+
GtkWidget *image;
GSList *profileMenuList;
@@ -84,7 +84,7 @@
gint nr_of_tabs;
gint textview_line_height;
-
+
MudTray *tray;
};
@@ -104,20 +104,31 @@
return TRUE;
}
-GtkWidget*
+GtkWidget*
mud_window_get_window(MudWindow *window)
{
return window->priv->window;
}
+static gboolean
+mud_window_grab_entry_focus_cb(GtkWidget *widget,
+GdkEventFocus *event, gpointer user_data)
+{
+ MudWindow *window = (MudWindow *)user_data;
+ gtk_widget_grab_focus(window->priv->textview);
+
+ return TRUE;
+}
+
void
mud_window_add_connection_view(MudWindow *window, MudConnectionView *view, gchar *tabLbl)
{
gint nr;
MudViewEntry *entry;
+ GtkWidget *terminal;
entry = g_new(MudViewEntry, 1);
-
+
g_assert(window != NULL);
g_assert(view != NULL);
@@ -126,7 +137,7 @@
gtk_notebook_remove_page(GTK_NOTEBOOK(window->priv->notebook), 0);
window->priv->image = NULL;
}
-
+
nr = gtk_notebook_append_page(GTK_NOTEBOOK(window->priv->notebook), mud_connection_view_get_viewport(view), gtk_label_new(tabLbl));
gtk_notebook_set_current_page(GTK_NOTEBOOK(window->priv->notebook), nr);
@@ -136,11 +147,14 @@
mud_connection_view_set_id(view, nr);
mud_connection_view_set_parent(view, window);
+ terminal = mud_connection_view_get_terminal(view);
+ g_signal_connect(terminal, "focus-in-event", G_CALLBACK(mud_window_grab_entry_focus_cb), window);
+
entry->id = nr;
entry->view = view;
-
+
window->priv->mud_views_list = g_slist_append(window->priv->mud_views_list, entry);
-
+
if (window->priv->nr_of_tabs > 1)
{
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->priv->notebook), TRUE);
@@ -151,13 +165,13 @@
mud_window_remove_connection_view(MudWindow *window, gint nr)
{
GSList *entry, *rementry;
-
+
rementry = NULL;
rementry = g_slist_append(rementry, NULL);
-
+
g_object_unref(window->priv->current_view);
gtk_notebook_remove_page(GTK_NOTEBOOK(window->priv->notebook), nr);
-
+
for(entry = window->priv->mud_views_list; entry != NULL; entry = g_slist_next(entry))
{
if(((MudViewEntry *)entry->data)->id == nr)
@@ -178,15 +192,15 @@
gint w, h;
GdkPixbuf *buf;
GError *gerr = NULL;
-
+
gtk_window_get_size(GTK_WINDOW(window->priv->window), &w, &h);
-
+
window->priv->image = gtk_image_new();
buf = gdk_pixbuf_new_from_file_at_size(GMPIXMAPSDIR "/gnome-mud.svg", w >> 1, h >> 1, &gerr);
gtk_image_set_from_pixbuf(GTK_IMAGE(window->priv->image), buf);
-
+
gtk_widget_show(window->priv->image);
-
+
gtk_notebook_append_page(GTK_NOTEBOOK(window->priv->notebook), window->priv->image, NULL);
}
}
@@ -217,7 +231,7 @@
gint nr = gtk_notebook_get_current_page(GTK_NOTEBOOK(window->priv->notebook));
mud_window_remove_connection_view(window, nr);
-
+
if(window->priv->nr_of_tabs == 0)
mud_tray_update_icon(window->priv->tray, offline_connecting);
}
@@ -267,7 +281,7 @@
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(window->priv->textview));
GtkTextIter start, end;
MudParseBase *base;
-
+
if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) &&
(event->state & gtk_accelerator_get_default_mod_mask()) == 0)
{
@@ -297,28 +311,28 @@
}
if(window->priv->current_view)
- {
+ {
if(event->keyval == GDK_Up)
{
text = mud_connection_view_get_history_item(
MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_UP);
-
+
gtk_text_buffer_set_text(buffer, text, strlen(text));
gtk_text_buffer_get_bounds(buffer, &start, &end);
gtk_text_buffer_select_range(buffer, &start, &end);
-
+
return TRUE;
}
-
+
if(event->keyval == GDK_Down)
{
text = mud_connection_view_get_history_item(
MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_DOWN);
-
+
gtk_text_buffer_set_text(buffer, text, strlen(text));
gtk_text_buffer_get_bounds(buffer, &start, &end);
gtk_text_buffer_select_range(buffer, &start, &end);
-
+
return TRUE;
}
}
@@ -336,7 +350,7 @@
if (window->priv->nr_of_tabs != 0)
{
name = mud_profile_get_name(mud_connection_view_get_current_profile(MUD_CONNECTION_VIEW(window->priv->current_view)));
-
+
mud_window_profile_menu_set_active(name, window);
if(mud_connection_view_islogging(MUD_CONNECTION_VIEW(window->priv->current_view)))
@@ -388,28 +402,28 @@
"Les Harris <me lesharris com>",
NULL
};
-
+
static const gchar * const documenters[] = {
"Jordi Mallach <jordi sindominio net>",
"Petter E. Stokke <gibreel project23 no>",
NULL
};
-
+
static const gchar * const artists[] = {
"Daniel Taylor <DanTaylor web de>",
"Andreas Nilsson <andreasn gnome org>",
NULL
};
-
+
static const gchar copyright[] = "Copyright \xc2\xa9 1998-2008 Robin Ericsson";
-
+
static const gchar comments[] = N_("A Multi-User Dungeon (MUD) client for GNOME");
-
+
GdkPixbuf *logo;
-
- logo = gdk_pixbuf_new_from_file_at_size(GMPIXMAPSDIR "/gnome-mud.svg",
+
+ logo = gdk_pixbuf_new_from_file_at_size(GMPIXMAPSDIR "/gnome-mud.svg",
128, 128, NULL);
-
+
gtk_show_about_dialog(GTK_WINDOW(window->priv->window),
"artists", artists,
"authors", authors,
@@ -422,44 +436,44 @@
"website", "http://amcl.sourceforge.net/",
"name", "gnome-mud",
NULL);
-
+
if(logo)
g_object_unref(logo);
-
+
}
static void
mud_window_mconnect_dialog(GtkWidget *widget, MudWindow *window)
{
GtkWidget *mywig;
-
+
mywig = window->priv->window;
-
+
mud_window_mconnect_new(window, mywig, window->priv->tray);
}
gboolean
mud_window_size_request(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
-{
+{
gint w, h;
GdkPixbuf *buf;
GError *gerr = NULL;
MudWindow *window = (MudWindow *)user_data;
-
+
gtk_window_get_size(GTK_WINDOW(window->priv->window), &w, &h);
-
+
if (window->priv->nr_of_tabs == 0)
{
buf = gdk_pixbuf_new_from_file_at_size(GMPIXMAPSDIR "/gnome-mud.svg", w >> 1, h >> 1, &gerr);
-
+
gtk_image_set_from_pixbuf(GTK_IMAGE(window->priv->image), buf);
}
gtk_widget_grab_focus(window->priv->textview);
-
+
// FIXME: Should send naws to all views.
mud_connection_view_send_naws(MUD_CONNECTION_VIEW(window->priv->current_view));
-
+
return FALSE;
}
@@ -474,7 +488,7 @@
glade = glade_xml_new(GLADEDIR "/connect.glade", "connect_window", NULL);
dialog = glade_xml_get_widget(glade, "connect_window");
-
+
entry_host = glade_xml_get_widget(glade, "entry_host");
entry_port = glade_xml_get_widget(glade, "entry_post");
gtk_entry_set_text(GTK_ENTRY(entry_host), window->priv->host);
@@ -486,7 +500,7 @@
MudConnectionView *view;
const gchar *host, *port;
gint iport;
-
+
g_free(window->priv->host);
host = gtk_entry_get_text(GTK_ENTRY(entry_host));
window->priv->host = g_strdup(host);
@@ -495,25 +509,25 @@
port = gtk_entry_get_text(GTK_ENTRY(entry_port));
window->priv->port = g_strdup(port);
iport = atoi(port);
-
+
if (iport < 1)
{
iport = 23;
}
-
+
mud_tray_update_icon(window->priv->tray, offline);
-
+
view = mud_connection_view_new("Default", host, iport, window->priv->window, (GtkWidget *)window->priv->tray, g_strdup(host));
mud_window_add_connection_view(window, view, g_strdup(host));
-
+
}
gtk_widget_destroy(dialog);
g_object_unref(glade);
}
-gboolean
+gboolean
save_dialog_vte_cb (VteTerminal *terminal,glong column,glong row,gpointer data)
{
return TRUE;
@@ -525,36 +539,36 @@
GladeXML *glade;
GtkWidget *dialog;
gint result;
-
+
glade = glade_xml_new(GLADEDIR "/main.glade", "save_dialog", NULL);
dialog = glade_xml_get_widget(glade, "save_dialog");
-
+
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "buffer.txt");
result = gtk_dialog_run(GTK_DIALOG(dialog));
if(result == GTK_RESPONSE_OK)
{
gchar *filename;
FILE *file;
-
+
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
file = fopen(filename, "w");
-
+
if(!file)
{
GtkWidget *errDialog;
-
+
errDialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Could not save the file in specified location!"));
gtk_dialog_run(GTK_DIALOG(errDialog));
gtk_widget_destroy(errDialog);
- }
+ }
else
{
gchar *bufferText;
GtkWidget *term;
-
+
term = mud_connection_view_get_terminal(MUD_CONNECTION_VIEW(window->priv->current_view));
-
+
bufferText = vte_terminal_get_text_range(VTE_TERMINAL(term),0,0,
vte_terminal_get_row_count(VTE_TERMINAL(term)),
vte_terminal_get_column_count(VTE_TERMINAL(term)),
@@ -563,12 +577,12 @@
NULL);
fwrite(bufferText, 1, strlen(bufferText), file);
- fclose(file);
+ fclose(file);
}
-
+
g_free(filename);
}
-
+
gtk_widget_destroy(dialog);
g_object_unref(glade);
}
@@ -611,7 +625,7 @@
{
MudProfile *profile;
GtkWidget *profileLabel;
-
+
profileLabel = gtk_bin_get_child(GTK_BIN(widget));
if (window->priv->current_view)
@@ -623,15 +637,15 @@
}
}
-void
+void
mud_window_profile_menu_set_cb(GtkWidget *widget, gpointer data)
{
gchar *name = (gchar *)data;
GtkWidget *label;
-
+
label = gtk_bin_get_child(GTK_BIN(widget));
-
+
if (GTK_IS_LABEL(label) && !strcmp(name,gtk_label_get_text(GTK_LABEL(label))))
{
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
@@ -644,7 +658,7 @@
mud_connection_view_start_logging(MUD_CONNECTION_VIEW(window->priv->current_view));
gtk_widget_set_sensitive(window->priv->startlog, FALSE);
gtk_widget_set_sensitive(window->priv->stoplog, TRUE);
-
+
}
void
@@ -655,14 +669,14 @@
gtk_widget_set_sensitive(window->priv->startlog, TRUE);
}
-void
+void
mud_window_profile_menu_set_active(gchar *name, MudWindow *window)
{
gtk_container_foreach(GTK_CONTAINER(window->priv->mi_profiles),mud_window_profile_menu_set_cb,(gpointer)name);
}
void mud_window_clear_profiles_menu(GtkWidget *widget, gpointer data)
-{
+{
gtk_widget_destroy(widget);
}
@@ -675,11 +689,11 @@
GtkWidget *sep;
GtkWidget *manage;
GtkWidget *icon;
-
+
window->priv->profileMenuList = NULL;
-
+
profiles = mud_profile_get_profiles();
-
+
gtk_container_foreach(GTK_CONTAINER(window->priv->mi_profiles), mud_window_clear_profiles_menu, NULL);
for (entry = (GList *)profiles; entry != NULL; entry = g_list_next(entry))
@@ -719,7 +733,7 @@
window->priv->port = g_strdup("");
window->priv->mud_views_list = NULL;
-
+
/* start glading */
glade = glade_xml_new(GLADEDIR "/main.glade", "main_window", NULL);
window->priv->window = glade_xml_get_widget(glade, "main_window");
@@ -762,7 +776,7 @@
g_signal_connect(glade_xml_get_widget(glade, "menu_preferences"), "activate", G_CALLBACK(mud_window_preferences_cb), window);
g_signal_connect(glade_xml_get_widget(glade, "menu_about"), "activate", G_CALLBACK(mud_window_about_cb), window);
-
+
/* other objects */
window->priv->notebook = glade_xml_get_widget(glade, "notebook");
g_signal_connect(window->priv->notebook, "switch-page", G_CALLBACK(mud_window_notebook_page_change), window);
@@ -793,20 +807,20 @@
window->priv->image = glade_xml_get_widget(glade, "image");
g_signal_connect(glade_xml_get_widget(glade, "plugin_list"), "activate", G_CALLBACK(do_plugin_information), NULL);
-
+
pluginMenu = glade_xml_get_widget(glade, "plugin_menu_menu");
window->priv->current_view = NULL;
window->priv->nr_of_tabs = 0;
-
+
g_signal_connect(window->priv->window, "configure-event", G_CALLBACK(mud_window_size_request), window);
window->priv->profileMenuList = NULL;
mud_window_populate_profiles_menu(window);
window->priv->tray = mud_tray_new(window, window->priv->window);
-
+
g_object_unref(glade);
}
@@ -830,9 +844,9 @@
for(entry = window->priv->mud_views_list; entry != NULL; entry = g_slist_next(entry))
{
- g_object_unref(((MudViewEntry *)entry->data)->view);
+ g_object_unref(((MudViewEntry *)entry->data)->view);
}
-
+
g_free(window->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -850,13 +864,13 @@
PLUGIN_DATA *pd;
viewlist = window->priv->mud_views_list;
-
+
for(entry = viewlist; entry != NULL; entry = g_slist_next(entry))
{
mudview = (MudViewEntry *)entry->data;
-
+
if(mudview->id == id)
- {
+ {
if(dir)
{
for(plugin_list = g_list_first(Plugin_data_list); plugin_list != NULL; plugin_list = plugin_list->next)
@@ -864,17 +878,17 @@
if(plugin_list->data != NULL)
{
pd = (PLUGIN_DATA *)plugin_list->data;
-
+
if(pd->plugin && pd->plugin->enabled && (pd->dir == PLUGIN_DATA_IN))
{
GString *buf = g_string_new(NULL);
int i;
-
+
for(i = 0; i < length; i++)
g_string_append_c(buf, data[i]);
-
+
(*pd->datafunc)(pd->plugin, buf->str, length, mudview->view);
-
+
g_string_free(buf, FALSE);
}
}
@@ -888,17 +902,17 @@
if(plugin_list->data != NULL)
{
pd = (PLUGIN_DATA *)plugin_list->data;
-
+
if(pd->plugin && pd->plugin->enabled && (pd->dir == PLUGIN_DATA_OUT))
{
GString *buf = g_string_new(NULL);
int i;
-
+
for(i = 0; i < length; i++)
g_string_append_c(buf, data[i]);
-
+
(*pd->datafunc)(pd->plugin, buf->str, length, mudview->view);
-
+
g_string_free(buf, FALSE);
}
}
@@ -912,10 +926,9 @@
mud_window_new (GConfClient *client)
{
MudWindow *window;
-
+
window = g_object_new(MUD_TYPE_WINDOW, NULL);
window->priv->gconf_client = client;
return window;
}
-
Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c (original)
+++ trunk/src/utils.c Sat Jun 28 05:02:32 2008
@@ -27,15 +27,15 @@
gint i;
GString *s = g_string_new(NULL);
gchar *ret;
-
+
for(i = 0; i < strlen(string); i++)
if(!g_ascii_isspace(string[i]))
g_string_append_c(s, string[i]);
-
+
ret = g_strdup(s->str);
-
+
g_string_free(s, TRUE);
-
+
return ret;
}
@@ -46,13 +46,13 @@
const gchar *c;
gint currChar = 0;
- if (!orig)
+ if (!orig)
return NULL;
buf = g_malloc(strlen(orig) * sizeof(gchar));
- for (c = orig; *c;)
+ for (c = orig; *c;)
{
- switch (*c)
+ switch (*c)
{
case '\x1B': // Esc Character
while (*c && *c++ != 'm') ;
@@ -66,7 +66,7 @@
buf[currChar++] = *c++;
}
}
-
+
return buf;
}
@@ -75,4 +75,3 @@
{
// use gtk_show_uri when available.
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]