* gnoemoe/gm-world.c: added static to functions, added flushing

history to disk
		* gnoemoe/dialogs/gm-world-paste-dialog.c: fixed sending with 
		  empty 'to' field
		* gnoemoe/widgets/gm-world-text-view.c: fixed blinking
This commit is contained in:
Jesse van den Kieboom 2006-06-18 19:52:37 +00:00
parent b3b456d5f1
commit 62b7cbc8cb
4 changed files with 56 additions and 24 deletions

View File

@ -1,3 +1,10 @@
2006-18-06 Jesse van den Kieboom <jesse@icecrew.nl>
* gnoemoe/gm-world.c: added static to functions, added flushing history
to disk
* gnoemoe/dialogs/gm-world-paste-dialog.c: fixed sending with empty
'to' field
* gnoemoe/widgets/gm-world-text-view.c: fixed blinking
2006-23-04 Jesse van den Kieboom <jesse@icecrew.nl>
* VERSION CHANGED TO 2.0.10
* gnoemoe/mcp/gm-cell-renderer-text.c: fixed font sizes for smaller

View File

@ -271,7 +271,7 @@ gm_world_paste_dialog_do_paste() {
gm_error_dialog(_("Please specify a command to be send"),
GTK_WINDOW(gm_world_paste_dialog_instance->dialog));
} else {
if (to) {
if (to && *to != '\0') {
cmd = g_strconcat(command, " ", to, NULL);
} else {
cmd = g_strdup(command);

View File

@ -17,21 +17,21 @@
#define GM_WORLD_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
GM_TYPE_WORLD, GmWorldPrivate))
void gm_world_save_input_history(GmWorld *world);
void gm_world_load_input_history(GmWorld *world);
void gm_world_load_triggers(GmWorld *world);
static void gm_world_save_input_history(GmWorld *world);
static void gm_world_load_input_history(GmWorld *world);
static void gm_world_load_triggers(GmWorld *world);
void on_gm_world_net_state_changing(GmNet *net, GmNetState state,
static void on_gm_world_net_state_changing(GmNet *net, GmNetState state,
GmWorld *world);
void on_gm_world_net_state_changed(GmNet *net, GmNetState state,
static void on_gm_world_net_state_changed(GmNet *net, GmNetState state,
GmWorld *world);
void on_gm_world_net_net_error(GmNet *net, gchar *error, gint code,
static void on_gm_world_net_net_error(GmNet *net, gchar *error, gint code,
GmWorld *world);
void on_gm_world_net_bytes_recv(GmNet *net, gchar *text, gint len,
static void on_gm_world_net_bytes_recv(GmNet *net, gchar *text, gint len,
GmWorld *world);
void on_gm_world_options_option_changed(GmOptions *options, gchar *key,
static void on_gm_world_options_option_changed(GmOptions *options, gchar *key,
GmWorld *world);
void on_gm_world_editor_save(GmEditor *editor, GmWorld *world);
static void on_gm_world_editor_save(GmEditor *editor, GmWorld *world);
struct _GmWorldPrivate {
gchar *path;
@ -42,6 +42,7 @@ struct _GmWorldPrivate {
gboolean manual_disconnect;
time_t manual_disconnect_timeout;
guint reconnect_id;
guint flush_history_id;
time_t last_command;
GmOptions *options;
@ -86,6 +87,8 @@ enum {
NUM_SIGNALS
};
#define HISTORY_FLUSH_INTERVAL (10 * 60000)
static guint world_signals[NUM_SIGNALS] = {0};
G_DEFINE_TYPE(GmWorld, gm_world, G_TYPE_OBJECT)
@ -107,6 +110,10 @@ gm_world_finalize(GObject *object) {
if (world->priv->reconnect_id) {
g_source_remove(world->priv->reconnect_id);
}
if (world->priv->flush_history_id) {
g_source_remove(world->priv->flush_history_id);
}
gm_g_list_free_simple(world->priv->history);
@ -320,7 +327,7 @@ gm_world_class_init(GmWorldClass *klass) {
g_type_class_add_private(object_class, sizeof(GmWorldPrivate));
}
void
static void
gm_world_create_default_settings(GmWorld *world) {
const gchar *loc = gm_default_charset();
@ -368,7 +375,7 @@ gm_world_init(GmWorld *world) {
G_CALLBACK(on_gm_world_options_option_changed), world);
}
void
static void
gm_world_load_input_history(GmWorld *world) {
FILE *f;
gchar line[1024], *filename;
@ -405,7 +412,7 @@ gm_world_load_input_history(GmWorld *world) {
g_free(filename);
}
void
static void
gm_world_save_input_history(GmWorld *world) {
FILE *f;
gchar *filename;
@ -438,7 +445,17 @@ gm_world_save_input_history(GmWorld *world) {
g_free(filename);
}
void
static gboolean
flush_history_cb(gpointer data) {
GmWorld *world = GM_WORLD(data);
gm_world_save_input_history(world);
world->priv->flush_history_id = 0;
return FALSE;
}
static void
gm_world_load_triggers(GmWorld *world) {
gchar *path;
gchar *oldpath;
@ -576,6 +593,11 @@ gm_world_unload(GmWorld *world) {
}
g_signal_emit(world, world_signals[UNLOAD], 0);
if (world->priv->flush_history_id) {
g_source_remove(world->priv->flush_history_id);
flush_history_cb(world);
}
}
}
@ -1156,6 +1178,12 @@ gm_world_sendln_log(GmWorld *world, gchar const *text, GmLogType logtype) {
gm_net_send_line(world->priv->net, normal);
g_free(normal);
if (world->priv->flush_history_id != 0)
g_source_remove(world->priv->flush_history_id);
world->priv->flush_history_id = g_timeout_add(HISTORY_FLUSH_INTERVAL,
flush_history_cb, world);
}
void
@ -1253,7 +1281,7 @@ gm_world_auto_login(GmWorld *world) {
/* Callbacks */
void
static void
on_gm_world_editor_save(GmEditor *editor, GmWorld *world) {
GList *line;
@ -1272,7 +1300,7 @@ on_gm_world_editor_save(GmEditor *editor, GmWorld *world) {
}
}
void
static void
on_gm_world_net_state_changing(GmNet *net, GmNetState state, GmWorld *world) {
GmNetState prev_state = gm_net_state(net);
@ -1309,7 +1337,7 @@ on_gm_world_net_state_changing(GmNet *net, GmNetState state, GmWorld *world) {
}
}
void
static void
on_gm_world_net_state_changed(GmNet *net, GmNetState state, GmWorld *world) {
if (state == GM_NET_STATE_CONNECTED) {
world->priv->manual_disconnect = FALSE;
@ -1322,14 +1350,14 @@ on_gm_world_net_state_changed(GmNet *net, GmNetState state, GmWorld *world) {
}
}
void
static void
on_gm_world_net_net_error(GmNet *net, gchar *error, gint code,
GmWorld *world) {
g_signal_emit(world, world_signals[WORLD_ERROR], 0, error, code);
gm_world_log(world, LOG_STATUS, error);
}
void
static void
on_gm_world_net_bytes_recv(GmNet *net, gchar *text, gint len,
GmWorld *world) {
gchar *all, *utext, *ptr, *start;
@ -1380,7 +1408,7 @@ on_gm_world_net_bytes_recv(GmNet *net, gchar *text, gint len,
g_free(all);
}
void
static void
on_gm_world_options_option_changed(GmOptions *options, gchar *key,
GmWorld *world) {
if (strcmp(key, "name") == 0) {

View File

@ -698,10 +698,7 @@ gm_world_text_view_blinker_iters(BlinkInfo *info, GtkTextIter *start,
if (end != NULL) {
*end = *start;
if (!gtk_text_iter_forward_to_tag_toggle(end, tag)) {
*end = *start;
}
gtk_text_iter_forward_chars(end, g_utf8_strlen(info->fill, -1));
}
if (tag_blink != NULL) {