gnome-mud r755 - in trunk: . src
- From: lharris svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-mud r755 - in trunk: . src
- Date: Sun, 22 Feb 2009 08:57:59 +0000 (UTC)
Author: lharris
Date: Sun Feb 22 08:57:59 2009
New Revision: 755
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=755&view=rev
Log:
Closed known memory leaks. Additional GString fixes.
Modified:
trunk/ChangeLog
trunk/src/mud-connection-view.c
trunk/src/mud-log.c
trunk/src/mud-parse-alias.c
trunk/src/mud-parse-base.c
trunk/src/mud-parse-trigger.c
trunk/src/mud-profile.c
trunk/src/mud-regex.c
trunk/src/mud-telnet-handlers.c
trunk/src/mud-telnet-msp.c
trunk/src/mud-telnet-msp.h
trunk/src/mud-telnet.c
trunk/src/mud-telnet.h
trunk/src/utils.c
Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c (original)
+++ trunk/src/mud-connection-view.c Sun Feb 22 08:57:59 2009
@@ -499,6 +499,25 @@
if(connection_view->connection)
gnet_conn_unref(connection_view->connection);
+ if(connection_view->priv->hostname)
+ g_free(connection_view->priv->hostname);
+
+ if(connection_view->priv->connect_string)
+ g_free(connection_view->priv->connect_string);
+
+ if(connection_view->priv->mud_name)
+ g_free(connection_view->priv->mud_name);
+
+ if(connection_view->priv->processed)
+ g_string_free(connection_view->priv->processed, TRUE);
+
+ if(connection_view->priv->telnet)
+ g_object_unref(connection_view->priv->telnet);
+
+ g_object_unref(connection_view->priv->log);
+ g_object_unref(connection_view->priv->parse);
+ g_object_unref(connection_view->priv->profile);
+
g_free(connection_view->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -542,7 +561,10 @@
view->connection = NULL;
if(view->priv->telnet)
+ {
g_object_unref(view->priv->telnet);
+ view->priv->telnet = NULL;
+ }
mud_connection_view_add_text(view, _("\n*** Connection closed.\n"), System);
}
@@ -584,6 +606,7 @@
view->connection = NULL;
g_object_unref(view->priv->telnet);
+ view->priv->telnet = NULL;
mud_connection_view_add_text(view,
_("\n*** Connection closed.\n"), System);
@@ -1164,7 +1187,10 @@
view->connection = NULL;
if(view->priv->telnet)
+ {
g_object_unref(view->priv->telnet);
+ view->priv->telnet = NULL;
+ }
mud_connection_view_add_text(view, _("*** Connection closed.\n"), Error);
Modified: trunk/src/mud-log.c
==============================================================================
--- trunk/src/mud-log.c (original)
+++ trunk/src/mud-log.c Sun Feb 22 08:57:59 2009
@@ -34,13 +34,13 @@
struct _MudLogPrivate
{
- gboolean active;
+ gboolean active;
- gchar *name;
- gchar *filename;
- gchar *dir;
+ gchar *name;
+ gchar *filename;
+ gchar *dir;
- FILE *logfile;
+ FILE *logfile;
};
GType mud_log_get_type (void);
@@ -56,61 +56,67 @@
GType
mud_log_get_type (void)
{
- static GType object_type = 0;
+ static GType object_type = 0;
- g_type_init();
+ g_type_init();
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (MudLogClass),
- NULL,
- NULL,
- (GClassInitFunc) mud_log_class_init,
- NULL,
- NULL,
- sizeof (MudLog),
- 0,
- (GInstanceInitFunc) mud_log_init,
- };
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (MudLogClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) mud_log_class_init,
+ NULL,
+ NULL,
+ sizeof (MudLog),
+ 0,
+ (GInstanceInitFunc) mud_log_init,
+ };
- object_type = g_type_register_static(G_TYPE_OBJECT, "MudLog", &object_info, 0);
- }
+ object_type = g_type_register_static(G_TYPE_OBJECT, "MudLog", &object_info, 0);
+ }
- return object_type;
+ return object_type;
}
static void
mud_log_init (MudLog *log)
{
- log->priv = g_new0(MudLogPrivate, 1);
+ log->priv = g_new0(MudLogPrivate, 1);
- log->priv->active = FALSE;
- log->priv->logfile = NULL;
- log->priv->name = NULL;
+ log->priv->active = FALSE;
+ log->priv->logfile = NULL;
+ log->priv->name = NULL;
}
static void
mud_log_class_init (MudLogClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
- object_class->finalize = mud_log_finalize;
+ object_class->finalize = mud_log_finalize;
}
static void
mud_log_finalize (GObject *object)
{
- MudLog *MLog;
- GObjectClass *parent_class;
+ MudLog *MLog;
+ GObjectClass *parent_class;
- MLog = MUD_LOG(object);
+ MLog = MUD_LOG(object);
- g_free(MLog->priv);
+ if(MLog->priv->active)
+ mud_log_close(MLog);
- parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
- parent_class->finalize(object);
+ if(MLog->priv->name)
+ g_free(MLog->priv->name);
+
+ g_free(MLog->priv);
+
+ parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
+ parent_class->finalize(object);
}
// MudLog Methods
@@ -118,86 +124,89 @@
void
mud_log_open(MudLog *log)
{
- gchar buf[1024];
- gchar nameBuf[1024];
- time_t t;
+ gchar buf[1024];
+ gchar nameBuf[1024];
+ time_t t;
- g_snprintf(buf, 1024, "%s/.gnome-mud/logs/%s", g_get_home_dir(), log->priv->name);
+ g_snprintf(buf, 1024, "%s/.gnome-mud/logs/%s", g_get_home_dir(), log->priv->name);
- log->priv->dir = g_strdup(buf);
+ log->priv->dir = g_strdup(buf);
- if(!g_file_test(buf, G_FILE_TEST_IS_DIR))
- if(mkdir(buf, 0777 ) == -1)
- return;
+ if(!g_file_test(buf, G_FILE_TEST_IS_DIR))
+ if(mkdir(buf, 0777 ) == -1)
+ return;
- g_snprintf(nameBuf, 1024, "%s.log", log->priv->name);
+ 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");
+ 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"),
- localtime(&t));
- fprintf(log->priv->logfile, "%s", buf);
- }
+ if (log->priv->logfile)
+ {
+ time(&t);
+ strftime(buf, 1024,
+ _("\n*** Log starts *** %d/%m/%Y %H:%M:%S\n"),
+ localtime(&t));
+ fprintf(log->priv->logfile, "%s", buf);
+ }
- log->priv->active = TRUE;
+ log->priv->active = TRUE;
}
void
mud_log_write(MudLog *log, gchar *data, gsize size)
{
- gchar *stripData;
- gint stripSize = 0;
+ gchar *stripData;
+ gint stripSize = 0;
+ gsize write_size;
+
+ if(log->priv->logfile == NULL || data == NULL)
+ return;
- if(log->priv->logfile == NULL || data == NULL)
- return;
+ stripData = strip_ansi((const gchar *)data);
+ stripSize = strlen(stripData);
- stripData = strip_ansi((const gchar *)data);
- stripSize = strlen(stripData);
+ write_size = fwrite(stripData, 1, stripSize, log->priv->logfile);
- if(!fwrite(stripData, 1, stripSize, log->priv->logfile))
- g_critical(_("Could not write data to log file!"));
+ if(write_size != stripSize)
+ g_critical(_("Could not write data to log file!"));
- g_free(stripData);
+ g_free(stripData);
}
void
mud_log_close(MudLog *log)
{
- gchar buf[255];
- time_t t;
+ gchar buf[255];
+ time_t t;
- if(log->priv->logfile == NULL)
- return;
+ if(log->priv->logfile == NULL)
+ return;
- time(&t);
- strftime(buf, 255,
- _("\n *** Log stops *** %d/%m/%Y %H:%M:%S\n"),
- localtime(&t));
+ time(&t);
+ strftime(buf, 255,
+ _("\n *** Log stops *** %d/%m/%Y %H:%M:%S\n"),
+ localtime(&t));
- fprintf(log->priv->logfile, "%s", buf);
- fclose(log->priv->logfile);
+ fprintf(log->priv->logfile, "%s", buf);
+ fclose(log->priv->logfile);
- log->priv->active = FALSE;
+ log->priv->active = FALSE;
}
void
mud_log_remove(MudLog *log)
{
- if(log->priv->active)
- mud_log_close(log);
+ if(log->priv->active)
+ mud_log_close(log);
- unlink(log->priv->filename);
+ unlink(log->priv->filename);
}
gboolean
mud_log_islogging(MudLog *log)
{
- return log->priv->active;
+ return log->priv->active;
}
// MudLog Utility Functions
@@ -205,22 +214,22 @@
void
mud_log_write_hook(MudLog *log, gchar *data, gint length)
{
- if(log->priv->active)
- mud_log_write(log, data, length);
+ if(log->priv->active)
+ mud_log_write(log, data, length);
}
// Instantiate MudLog
MudLog*
mud_log_new(gchar *mudName)
{
- MudLog *MLog;
+ MudLog *MLog;
- if( mudName == NULL)
- return NULL;
+ if( mudName == NULL)
+ return NULL;
- MLog = g_object_new(MUD_TYPE_LOG, NULL);
+ MLog = g_object_new(MUD_TYPE_LOG, NULL);
- MLog->priv->name = mudName;
+ MLog->priv->name = g_strdup(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 Sun Feb 22 08:57:59 2009
@@ -39,29 +39,29 @@
GType
mud_parse_alias_get_type (void)
{
- static GType object_type = 0;
+ static GType object_type = 0;
- g_type_init();
+ g_type_init();
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (MudParseAliasClass),
- NULL,
- NULL,
- (GClassInitFunc) mud_parse_alias_class_init,
- NULL,
- NULL,
- sizeof (MudParseAlias),
- 0,
- (GInstanceInitFunc) mud_parse_alias_init,
- };
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (MudParseAliasClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) mud_parse_alias_class_init,
+ NULL,
+ NULL,
+ sizeof (MudParseAlias),
+ 0,
+ (GInstanceInitFunc) mud_parse_alias_init,
+ };
- object_type = g_type_register_static(G_TYPE_OBJECT, "MudParseAlias", &object_info, 0);
- }
+ object_type = g_type_register_static(G_TYPE_OBJECT, "MudParseAlias", &object_info, 0);
+ }
- return object_type;
+ return object_type;
}
static void
@@ -73,86 +73,87 @@
static void
mud_parse_alias_class_init (MudParseAliasClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
- object_class->finalize = mud_parse_alias_finalize;
+ object_class->finalize = mud_parse_alias_finalize;
}
static void
mud_parse_alias_finalize (GObject *object)
{
- MudParseAlias *parse_alias;
- GObjectClass *parent_class;
+ MudParseAlias *parse_alias;
+ GObjectClass *parent_class;
- parse_alias = MUD_PARSE_ALIAS(object);
+ parse_alias = MUD_PARSE_ALIAS(object);
-
- parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
- parent_class->finalize(object);
+ parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
+ parent_class->finalize(object);
}
// MudParseAlias Methods
gboolean
mud_parse_alias_do(gchar *data, MudConnectionView *view, MudRegex *regex, MudParseAlias *alias)
{
- gchar *profile_name;
- gchar *actions;
- gchar *regexstr;
- GSList *aliases, *entry;
- GConfClient *client;
- GError *error = NULL;
- gchar keyname[2048];
- 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);
- 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);
- }
- }
+ gchar *profile_name;
+ gchar *actions;
+ gchar *regexstr;
+ GSList *aliases, *entry;
+ GConfClient *client;
+ GError *error = NULL;
+ gchar keyname[2048];
+ 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);
+ 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);
+ }
+ }
+
+ for(entry = aliases; entry != NULL; entry = g_slist_next(entry))
+ if(entry->data)
+ g_free(entry->data);
+
+ if(aliases)
+ g_slist_free(aliases);
- if(aliases)
- g_slist_free(aliases);
+ g_object_unref(client);
- return send_line;
+ return send_line;
}
// Instantiate MudParseAlias
MudParseAlias*
mud_parse_alias_new(void)
{
- MudParseAlias *pa;
-
- pa = g_object_new(MUD_TYPE_PARSE_ALIAS, NULL);
-
- return pa;
+ return g_object_new(MUD_TYPE_PARSE_ALIAS, NULL);
}
Modified: trunk/src/mud-parse-base.c
==============================================================================
--- trunk/src/mud-parse-base.c (original)
+++ trunk/src/mud-parse-base.c Sun Feb 22 08:57:59 2009
@@ -63,250 +63,254 @@
GType
mud_parse_base_get_type (void)
{
- static GType object_type = 0;
+ static GType object_type = 0;
- g_type_init();
+ g_type_init();
- if (!object_type)
- {
- static const GTypeInfo object_info =
- {
- sizeof (MudParseBaseClass),
- NULL,
- NULL,
- (GClassInitFunc) mud_parse_base_class_init,
- NULL,
- NULL,
- sizeof (MudParseBase),
- 0,
- (GInstanceInitFunc) mud_parse_base_init,
- };
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (MudParseBaseClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) mud_parse_base_class_init,
+ NULL,
+ NULL,
+ sizeof (MudParseBase),
+ 0,
+ (GInstanceInitFunc) mud_parse_base_init,
+ };
- object_type = g_type_register_static(G_TYPE_OBJECT, "MudParseBase", &object_info, 0);
- }
+ object_type = g_type_register_static(G_TYPE_OBJECT, "MudParseBase", &object_info, 0);
+ }
- return object_type;
+ return object_type;
}
static void
mud_parse_base_init (MudParseBase *pb)
{
- pb->priv = g_new0(MudParseBasePrivate, 1);
+ 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();
+ pb->priv->regex = mud_regex_new();
+ pb->priv->alias = mud_parse_alias_new();
+ pb->priv->trigger = mud_parse_trigger_new();
}
static void
mud_parse_base_class_init (MudParseBaseClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
- object_class->finalize = mud_parse_base_finalize;
+ object_class->finalize = mud_parse_base_finalize;
}
static void
mud_parse_base_finalize (GObject *object)
{
- MudParseBase *parse_base;
- GObjectClass *parent_class;
+ MudParseBase *parse_base;
+ GObjectClass *parent_class;
- parse_base = MUD_PARSE_BASE(object);
+ parse_base = MUD_PARSE_BASE(object);
- g_free(parse_base->priv);
+ g_object_unref(parse_base->priv->regex);
+ g_object_unref(parse_base->priv->alias);
+ g_object_unref(parse_base->priv->trigger);
- parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
- parent_class->finalize(object);
+ g_free(parse_base->priv);
+
+ parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
+ parent_class->finalize(object);
}
// MudParseBase Methods
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);
+ return mud_parse_trigger_do(data, base->priv->parentview, base->priv->regex, base->priv->trigger);
}
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);
+ return mud_parse_alias_do(data, base->priv->parentview, base->priv->regex, base->priv->alias);
}
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;
- gchar *replace_text;
- gchar charbuf[2];
- gboolean new_send_line = TRUE;
- gchar *send_line = NULL;
- ParseObject *po = NULL;
- GSList *parse_list, *entry;
-
- parse_list = NULL;
- len = strlen(data);
-
- // Lexer/Tokenizer
- if(data[0] == '%' && len > 1 && g_ascii_isdigit(data[1]))
- state = PARSE_STATE_REGISTER;
- else
- state = PARSE_STATE_TEXT;
-
- for(i = 0; i < len; i++)
- {
- switch(state)
- {
- case PARSE_STATE_TEXT:
- po = g_malloc(sizeof(ParseObject));
- parse_list = g_slist_prepend(parse_list, (gpointer) po);
-
- g_snprintf(charbuf, 2, "%c", data[i]);
-
- 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] != '%')
- state = PARSE_STATE_INTEXT;
- else
- 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;
- break;
-
- case PARSE_STATE_REGISTER:
- po = g_malloc(sizeof(ParseObject));
- parse_list = g_slist_prepend(parse_list, (gpointer)po);
-
- 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]))
- state = PARSE_STATE_REGISTER;
- else if(!g_ascii_isdigit(data[i+1]))
- state = PARSE_STATE_TEXT;
- }
- break;
- }
- }
-
-
- /* We prepend items to the list for speed but we need
- 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:
- if(new_send_line)
- {
- new_send_line = FALSE;
- send_line = g_strdup(myParse->data);
- }
- 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;
- send_line = g_strdup(replace_text);
- }
- else
- send_line = g_strconcat((const gchar *)send_line, (const gchar *)replace_text, NULL);
-
- g_free(replace_text);
- }
- else
- g_warning("Register number exceeded maximum - 510.");
- break;
- }
- }
-
- // Free our memory
- 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);
- g_free(send_line);
+ gint i, state, len, reg_num, reg_len, startword, endword, replace_len, curr_char;
+ gchar *replace_text;
+ gchar charbuf[2];
+ gboolean new_send_line = TRUE;
+ gchar *send_line = NULL;
+ ParseObject *po = NULL;
+ GSList *parse_list, *entry;
+
+ parse_list = NULL;
+ len = strlen(data);
+
+ // Lexer/Tokenizer
+ if(data[0] == '%' && len > 1 && g_ascii_isdigit(data[1]))
+ state = PARSE_STATE_REGISTER;
+ else
+ state = PARSE_STATE_TEXT;
+
+ for(i = 0; i < len; i++)
+ {
+ switch(state)
+ {
+ case PARSE_STATE_TEXT:
+ po = g_malloc(sizeof(ParseObject));
+ parse_list = g_slist_prepend(parse_list, (gpointer) po);
+
+ g_snprintf(charbuf, 2, "%c", data[i]);
+
+ 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] != '%')
+ state = PARSE_STATE_INTEXT;
+ else
+ 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;
+ break;
+
+ case PARSE_STATE_REGISTER:
+ po = g_malloc(sizeof(ParseObject));
+ parse_list = g_slist_prepend(parse_list, (gpointer)po);
+
+ 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]))
+ state = PARSE_STATE_REGISTER;
+ else if(!g_ascii_isdigit(data[i+1]))
+ state = PARSE_STATE_TEXT;
+ }
+ break;
+ }
+ }
+
+ /* We prepend items to the list for speed but we need
+ 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:
+ if(new_send_line)
+ {
+ new_send_line = FALSE;
+ send_line = g_strdup(myParse->data);
+ }
+ 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;
+ send_line = g_strdup(replace_text);
+ }
+ else
+ send_line = g_strconcat((const gchar *)send_line, (const gchar *)replace_text, NULL);
+
+ g_free(replace_text);
+ }
+ else
+ g_warning("Register number exceeded maximum - 510.");
+ break;
+ }
+ }
+
+ // Free our memory
+ 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);
+ g_free(send_line);
}
// Instantiate MudParseBase
MudParseBase*
mud_parse_base_new(MudConnectionView *parentview)
{
- MudParseBase *pb;
+ MudParseBase *pb;
- pb = g_object_new(MUD_TYPE_PARSE_BASE, NULL);
+ pb = g_object_new(MUD_TYPE_PARSE_BASE, NULL);
- pb->priv->parentview = parentview;
+ pb->priv->parentview = parentview;
- return pb;
+ return pb;
}
Modified: trunk/src/mud-parse-trigger.c
==============================================================================
--- trunk/src/mud-parse-trigger.c (original)
+++ trunk/src/mud-parse-trigger.c Sun Feb 22 08:57:59 2009
@@ -104,75 +104,77 @@
gboolean
mud_parse_trigger_do(gchar *data, MudConnectionView *view, MudRegex *regex, MudParseTrigger *trig)
{
- gchar *profile_name;
- gchar *actions;
- gchar *regexstr;
- gchar *stripped_data;
- GSList *triggers, *entry;
- GConfClient *client;
- GError *error = NULL;
- gchar keyname[2048];
- gint enabled;
- 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);
- 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);
- gag = gconf_client_get_int(client, keyname, &error);
-
- // FIXME: Kill this global and get a sane
- // 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);
- }
- }
+ gchar *profile_name;
+ gchar *actions;
+ gchar *regexstr;
+ gchar *stripped_data;
+ GSList *triggers, *entry;
+ GConfClient *client;
+ GError *error = NULL;
+ gchar keyname[2048];
+ gint enabled;
+ 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);
+ 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);
+ gag = gconf_client_get_int(client, keyname, &error);
+
+ // FIXME: Kill this global and get a sane
+ // 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);
+ }
+ }
+
+ for(entry = triggers; entry != NULL; entry = g_slist_next(entry))
+ if(entry->data)
+ g_free(entry->data);
- if(triggers)
- g_slist_free(triggers);
+ if(triggers)
+ g_slist_free(triggers);
- return doGag;
+ g_object_unref(client);
+
+ return doGag;
}
// Instantiate MudParseTrigger
MudParseTrigger*
mud_parse_trigger_new(void)
{
- MudParseTrigger *pt;
-
- pt = g_object_new(MUD_TYPE_PARSE_TRIGGER, NULL);
-
- return pt;
+ return g_object_new(MUD_TYPE_PARSE_TRIGGER, NULL);
}
Modified: trunk/src/mud-profile.c
==============================================================================
--- trunk/src/mud-profile.c (original)
+++ trunk/src/mud-profile.c Sun Feb 22 08:57:59 2009
@@ -134,35 +134,35 @@
object_class->finalize = mud_profile_finalize;
signal_changed =
- g_signal_new("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(MudProfileClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_signal_new("changed",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(MudProfileClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
}
static void
mud_profile_finalize (GObject *object)
{
- MudProfile *profile;
- GObjectClass *parent_class;
+ MudProfile *profile;
+ GObjectClass *parent_class;
- profile = MUD_PROFILE(object);
+ 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.MudListFile);
- g_free(profile->priv->preferences.LastLogDir);
+ 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);
+ g_free(profile->priv);
+ g_free(profile->name);
- parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
- parent_class->finalize(object);
+ parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
+ parent_class->finalize(object);
}
void
Modified: trunk/src/mud-regex.c
==============================================================================
--- trunk/src/mud-regex.c (original)
+++ trunk/src/mud-regex.c Sun Feb 22 08:57:59 2009
@@ -96,6 +96,9 @@
regex = MUD_REGEX(object);
+ if(regex->priv->substring_list)
+ pcre_free_substring_list(regex->priv->substring_list);
+
g_free(regex->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
Modified: trunk/src/mud-telnet-handlers.c
==============================================================================
--- trunk/src/mud-telnet-handlers.c (original)
+++ trunk/src/mud-telnet-handlers.c Sun Feb 22 08:57:59 2009
@@ -224,7 +224,7 @@
encoding = g_string_new(NULL);
while(buf[index] != (guchar)TEL_SE)
- g_string_append_c(encoding, buf[index++]);
+ encoding = g_string_append_c(encoding, buf[index++]);
sep_buf[0] = (gchar)sep;
sep_buf[1] = '\0';
@@ -281,7 +281,7 @@
{
if(buf[count] == '\0')
{
- g_string_append(args,"|gmud_sep|");
+ args = g_string_append(args,"|gmud_sep|");
count++;
continue;
}
@@ -289,7 +289,7 @@
g_string_append_c(args, buf[count++]);
}
- g_string_prepend(args, command_buf);
+ args = g_string_prepend(args, command_buf);
argv = g_strsplit(args->str, "|gmud_sep|", -1);
argc = g_strv_length(argv);
Modified: trunk/src/mud-telnet-msp.c
==============================================================================
--- trunk/src/mud-telnet-msp.c (original)
+++ trunk/src/mud-telnet-msp.c Sun Feb 22 08:57:59 2009
@@ -42,7 +42,6 @@
gint len);
static void mud_telnet_msp_process_command(MudTelnet *telnet,
MudMSPCommand *command);
-static void mud_telnet_msp_stop_playing(MudTelnet *telnet, MudMSPTypes type);
static void mud_telnet_msp_start_playing(MudTelnet *telnet, MudMSPTypes type);
static gboolean mud_telnet_msp_get_files(MudTelnet *telnet, MudMSPTypes type);
static gboolean mud_telnet_msp_sound_bus_call (GstBus *bus,
@@ -598,7 +597,7 @@
}
}
-static void
+void
mud_telnet_msp_stop_playing(MudTelnet *telnet, MudMSPTypes type)
{
telnet->sound[type].playing = FALSE;
Modified: trunk/src/mud-telnet-msp.h
==============================================================================
--- trunk/src/mud-telnet-msp.h (original)
+++ trunk/src/mud-telnet-msp.h Sun Feb 22 08:57:59 2009
@@ -100,6 +100,7 @@
void mud_telnet_msp_parser_clear(MudTelnet *telnet);
void mud_telnet_msp_download_item_free(MudMSPDownloadItem *item);
GString *mud_telnet_msp_parse(MudTelnet *telnet, GString *buf, gint *len);
+void mud_telnet_msp_stop_playing(MudTelnet *telnet, MudMSPTypes type);
#endif
Modified: trunk/src/mud-telnet.c
==============================================================================
--- trunk/src/mud-telnet.c (original)
+++ trunk/src/mud-telnet.c Sun Feb 22 08:57:59 2009
@@ -61,11 +61,13 @@
static gint mud_telnet_get_index_by_option(MudTelnet *telnet, guchar option_number);
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
+mud_telnet_handle_positive_nego(MudTelnet *telnet,
+ const guchar opt_no,
+ const guchar affirmative,
+ const guchar negative,
+ gint him);
static gint
mud_telnet_handle_negative_nego(MudTelnet *telnet,
const guchar opt_no,
@@ -114,6 +116,7 @@
#ifdef ENABLE_GST
telnet->prev_buffer = NULL;
+ telnet->base_url = NULL;
#endif
}
@@ -143,8 +146,13 @@
g_free(telnet->mud_name);
#ifdef ENABLE_GST
+ mud_telnet_msp_stop_playing(telnet, MSP_TYPE_SOUND);
+ mud_telnet_msp_stop_playing(telnet, MSP_TYPE_MUSIC);
+
if(telnet->prev_buffer)
g_string_free(telnet->prev_buffer, TRUE);
+ if(telnet->base_url)
+ g_free(telnet->base_url);
#endif
#ifdef ENABLE_MCCP
@@ -157,6 +165,8 @@
}
#endif
+ mud_zmp_finalize(telnet);
+
g_free(telnet->priv);
parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
@@ -190,6 +200,8 @@
telnet->pos = 0;
telnet->subreq_pos = 0;
+ telnet->zmp_commands = NULL;
+
#ifdef ENABLE_GST
telnet->sound[0].files = NULL;
telnet->sound[0].current_command = NULL;
Modified: trunk/src/mud-telnet.h
==============================================================================
--- trunk/src/mud-telnet.h (original)
+++ trunk/src/mud-telnet.h Sun Feb 22 08:57:59 2009
@@ -176,6 +176,7 @@
MudMSPTypes msp_type;
MudMSPSound sound[2];
gchar *base_url;
+ GString *prev_buffer;
#endif
#ifdef ENABLE_MCCP
@@ -183,7 +184,6 @@
guchar *compress_out_buf;
gboolean mccp;
gboolean mccp_new;
- GString *prev_buffer;
#endif
GString *processed;
Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c (original)
+++ trunk/src/utils.c Sun Feb 22 08:57:59 2009
@@ -27,55 +27,46 @@
{
gint i;
GString *s;
- gchar *ret;
if(string == NULL)
return NULL;
s = g_string_new(NULL);
- for(i = 0; i < strlen(string); i++)
+
+ for(i = 0; i < strlen(string); i++)
if(!g_ascii_isspace(string[i]))
- g_string_append_c(s, string[i]);
+ s = g_string_append_c(s, string[i]);
- ret = g_strdup(s->str);
-
- g_string_free(s, TRUE);
-
- return ret;
+ return g_string_free(s, FALSE);
}
gchar *
strip_ansi(const gchar *orig)
{
- GString *buf = g_string_new(NULL);
- const gchar *c;
- gchar *ret = NULL;
-
- if (!orig)
- return NULL;
-
- for (c = orig; *c;)
- {
- switch (*c)
- {
- case '\x1B': // Esc Character
- while (*c && *c++ != 'm') ;
- break;
-
- case '\02': // HTML Open bracket
- while (*c && *c++ != '\03'); // HTML Close bracket
- break;
+ GString *buf = g_string_new(NULL);
+ const gchar *c;
- default:
- g_string_append_c(buf, *c++);
- }
- }
+ if (!orig)
+ return NULL;
- ret = g_strdup(buf->str);
-
- g_string_free(buf, TRUE);
+ for (c = orig; *c;)
+ {
+ switch (*c)
+ {
+ case '\x1B': // Esc Character
+ while (*c && *c++ != 'm') ;
+ break;
+
+ case '\02': // HTML Open bracket
+ while (*c && *c++ != '\03'); // HTML Close bracket
+ break;
+
+ default:
+ buf = g_string_append_c(buf, *c++);
+ }
+ }
- return ret;
+ return g_string_free(buf, FALSE);
}
void
@@ -87,40 +78,40 @@
void
utils_error_message(GtkWidget *parent, const gchar *title, const gchar *fmt, ...)
{
- GtkWidget *dialog, *label, *icon, *hbox;
- va_list args;
- gchar *message;
-
- dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(parent),
- GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK,
- GTK_RESPONSE_NONE, NULL);
-
- if(fmt)
- {
- va_start(args, fmt);
- message = g_strdup_vprintf(fmt, args);
- va_end(args);
-
- label = gtk_label_new(message);
- gtk_label_set_selectable(GTK_LABEL(label), TRUE);
- g_free(message);
- }
- else
- {
- label = gtk_label_new("Unknown error.");
- gtk_label_set_selectable(GTK_LABEL(label), TRUE);
- }
-
- icon = gtk_image_new_from_icon_name("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
- hbox = gtk_hbox_new(FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ GtkWidget *dialog, *label, *icon, *hbox;
+ va_list args;
+ gchar *message;
+
+ dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK,
+ GTK_RESPONSE_NONE, NULL);
+
+ if(fmt)
+ {
+ va_start(args, fmt);
+ message = g_strdup_vprintf(fmt, args);
+ va_end(args);
+
+ label = gtk_label_new(message);
+ gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+ g_free(message);
+ }
+ else
+ {
+ label = gtk_label_new("Unknown error.");
+ gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+ }
+
+ icon = gtk_image_new_from_icon_name("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
+ hbox = gtk_hbox_new(FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_widget_show_all(dialog);
+ gtk_widget_show_all(dialog);
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]