This commit is contained in:
Jesse van den Kieboom 2006-03-29 12:23:28 +00:00
parent 47c201615e
commit 7ba7577534
5 changed files with 29 additions and 24 deletions

View File

@ -534,14 +534,18 @@ gm_app_add_world(GmApp *app, GmWorld *world) {
void
gm_app_remove_world(GmApp *app, GmWorld *world) {
// Only remove when not loaded
const gchar *path = gm_world_path(world);
gchar *path;
if (!gm_world_loaded(world)) {
path = g_strdup(gm_world_path(world));
app->priv->worlds = g_list_remove(app->priv->worlds, world);
g_signal_emit(app, app_signals[WORLD_REMOVED], 0, world);
g_object_unref(world);
gm_directory_remove_all(path, TRUE);
g_free(path);
}
}

View File

@ -243,8 +243,6 @@ gm_editor_write_lines(GmEditor *editor) {
if (write(fd, line->data, strlen(line->data)) == -1) {
gm_debug_msg(DEBUG_ALWAYS, "Writing failed");
break;
} else {
gm_debug_msg(DEBUG_ALWAYS, "Written: %s", line->data);
}
if (line->next) {

View File

@ -118,40 +118,40 @@ gm_g_list_find_simple(GList *s, gchar *f) {
return NULL;
}
void
gint
gm_dialog(gchar * message, GtkMessageType messagebox_type,
GtkWindow * parent) {
gint buttons_type, GtkWindow * parent) {
GtkWidget *dlg;
if (parent == NULL) {
//parent = GTK_WINDOW(if_main_get_widget("wndMain"));
}
gint result;
dlg = gtk_message_dialog_new(parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
messagebox_type, GTK_BUTTONS_OK, message, NULL);
gtk_dialog_run(GTK_DIALOG(dlg));
messagebox_type, buttons_type, message, NULL);
result = gtk_dialog_run(GTK_DIALOG(dlg));
gtk_widget_destroy(dlg);
return result;
}
void
gint
gm_error_dialog(gchar * message, GtkWindow * parent) {
gm_dialog(message, GTK_MESSAGE_ERROR, parent);
return gm_dialog(message, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, parent);
}
void
gint
gm_warning_dialog(gchar * message, GtkWindow * parent) {
gm_dialog(message, GTK_MESSAGE_WARNING, parent);
return gm_dialog(message, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, parent);
}
void
gint
gm_info_dialog(gchar * message, GtkWindow * parent) {
gm_dialog(message, GTK_MESSAGE_INFO, parent);
return gm_dialog(message, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, parent);
}
void
gint
gm_question_dialog(gchar * message, GtkWindow * parent) {
gm_dialog(message, GTK_MESSAGE_QUESTION, parent);
return gm_dialog(message, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, parent);
}
void

View File

@ -119,10 +119,10 @@ int garray_length(gchar **s);
void gm_g_list_free_simple(GList *s);
gchar *gm_g_list_find_simple(GList *s, gchar *f);
void gm_error_dialog(gchar * message, GtkWindow * parent);
void gm_warning_dialog(gchar * message, GtkWindow * parent);
void gm_info_dialog(gchar * message, GtkWindow * parent);
void gm_question_dialog(gchar * message, GtkWindow * parent);
gint gm_error_dialog(gchar * message, GtkWindow * parent);
gint gm_warning_dialog(gchar * message, GtkWindow * parent);
gint gm_info_dialog(gchar * message, GtkWindow * parent);
gint gm_question_dialog(gchar * message, GtkWindow * parent);
void gm_do_events();

View File

@ -21,6 +21,9 @@ static const GtkActionEntry gm_sensitive_menu_entries[] =
/* World menu */
{"WorldNew", GTK_STOCK_NEW, N_("New World..."), "<control>N",
N_("Create a new world"), G_CALLBACK(on_gm_app_view_world_new)},
{"WorldOpen", GTK_STOCK_OPEN, N_("Open World..."), "<control>O",
N_("Open an existing world"),
G_CALLBACK(on_gm_app_view_world_open)},
{"WorldQuit", GTK_STOCK_QUIT, NULL, NULL,
N_("Quit the program"), G_CALLBACK(on_gm_app_view_world_quit)},