From 2c501e01eaa48b3c17d369a01f719111bbd5b7fa Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Tue, 10 Jan 2006 00:42:09 +0000 Subject: [PATCH] Fixed includes --- gnoemoe/gm-app.c | 107 +-------------------------------------- gnoemoe/gm-color-table.c | 51 ++++++++++++------- gnoemoe/gm-pixbuf.c | 2 +- gnoemoe/gm-scripts.c | 10 ++++ gnoemoe/gm-support.c | 2 +- gnoemoe/gm-world.c | 2 +- 6 files changed, 49 insertions(+), 125 deletions(-) diff --git a/gnoemoe/gm-app.c b/gnoemoe/gm-app.c index b926432..06472d6 100644 --- a/gnoemoe/gm-app.c +++ b/gnoemoe/gm-app.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include #endif #include @@ -14,8 +14,7 @@ #include "gm-color-table.h" #include "gm-app.h" -#include "ansi.h" -//#include "editor.h" +#include "gm-ansi.h" #include "gm-debug.h" #include "gm-pixbuf.h" #include "gm-support.h" @@ -26,13 +25,6 @@ static gboolean show_version = FALSE; static gboolean recover = FALSE; static gchar *load_worlds = NULL; static GmApp *application; - -//static void gm_app_tray_create(tray_info *t); -//gboolean on_gm_app_tray_button_press(GtkWidget *widget, GdkEventButton *event, -// gpointer user_data); -//gboolean on_gm_app_tray_destroy(GtkWidget *widget, gpointer user_data); -void on_gm_app_view_size_allocate(GmAppView *view, GtkAllocation *allocation, - GmApp *app); struct poptOption poptions[] = { {"debug", 'd', POPT_ARG_STRING, &debug_level, 0, N_("Enable debugging. " @@ -87,14 +79,11 @@ gm_app_finalize(GObject *object) { GmApp *app = GM_APP(object); gnome_vfs_shutdown(); - //mcp_fini(); - //editor_fini(); #ifdef HAVE_RUBY g_object_unref(app->priv->scripts); #endif - //mcpconsole_fini(); gm_app_destroy_worlds(app); gm_pixbuf_fini(); @@ -152,8 +141,6 @@ gm_app_init(GmApp *app) { app->priv->options = NULL; app->priv->client = NULL; app->priv->worlds = NULL; - - //gm_app_tray_create(&(app->priv->tray)); } /* Private functions */ @@ -174,35 +161,6 @@ on_gm_app_session_die(GnomeClient * client, gpointer client_data) { gtk_main_quit(); } -/*static void -gm_app_tray_create(tray_info *t) { - t->flash_timeout = 0; - t->icon = egg_tray_icon_new(_("GnoeMoe Gnome MOO Client")); - t->event_box = gtk_event_box_new(); - - t->iconnr = TRAY_ICON_DEFAULT; - t->image = gtk_image_new_from_pixbuf( - gnoe_pixbuf_get("tray/default.svg")); - - gtk_container_add(GTK_CONTAINER(t->event_box), t->image); - t->tooltips = gtk_tooltips_new(); - - gtk_widget_show(t->event_box); - gtk_widget_show(t->image); - - gtk_container_add(GTK_CONTAINER(t->icon), t->event_box); - gtk_widget_show(GTK_WIDGET(t->icon)); - - gtk_widget_add_events(GTK_WIDGET(t->icon), GDK_BUTTON_PRESS_MASK); - - g_signal_connect(t->icon, "button_press_event", - G_CALLBACK(on_gm_app_tray_button_press), NULL); - - // Handles when the area is removed from the panel. - g_signal_connect(t->icon, "destroy", G_CALLBACK(on_gm_app_tray_destroy), - t->event_box); -}*/ - static gboolean on_gm_app_save_session(GnomeClient * client, gint phase, GnomeSaveStyle save_style, gint is_shutdown, @@ -412,24 +370,10 @@ gm_app_run(GmApp *app) { const gchar *savedState; int i = 0; GmWorld *world; - int width, height; app->priv->view = gm_app_view_new(app); - - width = gm_options_get_int(app->priv->options, "width"); - height = gm_options_get_int(app->priv->options, "height"); - - if (height > 10 && width > 10) { - gtk_window_set_default_size(GTK_WINDOW(app->priv->view), width, height); - } - gtk_widget_show(GTK_WIDGET(app->priv->view)); - //mcpconsole_init(); - - g_signal_connect(app->priv->view, "size_allocate", - G_CALLBACK(on_gm_app_view_size_allocate), app); - #ifdef HAVE_RUBY gm_scripts_load(app->priv->scripts); #endif @@ -608,50 +552,3 @@ main(int argc, char *argv[]) { return 0; } -/* Callbacks */ -void -on_gm_app_view_size_allocate(GmAppView *view, GtkAllocation *allocation, - GmApp *app) { - gm_options_set_int(app->priv->options, "width", allocation->width); - gm_options_set_int(app->priv->options, "height", allocation->height); -} - -/*gboolean -on_gm_app_tray_button_press(GtkWidget *widget, GdkEventButton *event, - gpointer user_data) { - if (event->type == GDK_2BUTTON_PRESS || - event->type == GDK_3BUTTON_PRESS) { - return FALSE; - } - - switch (event->button) { - case 1: - if_main_show_hide(!GTK_WIDGET_VISIBLE(wndMain)); - break; - default: - return FALSE; - } - - return TRUE; -} - -gboolean -on_gm_app_tray_destroy(GtkWidget *widget, gpointer user_data) { - gtk_widget_destroy(GTK_WIDGET(app_tray_info.icon)); - app_tray_info.icon = NULL; - app_tray_info.event_box = NULL; - app_tray_info.image = NULL; - app_tray_info.tooltips = NULL; - - if (app_tray_info.flash_timeout != 0) { - g_source_remove(app_tray_info.flash_timeout); - } - - tray_create(&app_tray_info); - - if (!have_tray()) { - gtk_widget_show(if_main_get_widget("wndMain")); - } - - return TRUE; -}*/ diff --git a/gnoemoe/gm-color-table.c b/gnoemoe/gm-color-table.c index b488645..dbb8b80 100644 --- a/gnoemoe/gm-color-table.c +++ b/gnoemoe/gm-color-table.c @@ -1,8 +1,8 @@ #include #include #include "gm-color-table.h" -#include "string.h" -#include "ansi.h" +#include +#include "gm-ansi.h" #include "gm-debug.h" #define GM_COLOR_TABLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GM_TYPE_COLOR_TABLE, GmColorTablePrivate)) @@ -390,15 +390,23 @@ gm_color_table_set(GmColorTable *table, gchar const *name, gchar const *hex) { if (table->priv->scheme != SCHEME_USER) { table->priv->scheme = SCHEME_USER; - // Store all current values in the options - for (item = scheme_default; item->name != NULL; ++item) { - it = g_hash_table_lookup(table->priv->colors, item->name); - gm_options_set(table->priv->options, item->name, it->hex); + if (table->priv->options) { + gm_options_set(table->priv->options, "color_scheme", + scheme_names[SCHEME_USER].name); + + // Store all current values in the options + for (item = scheme_default; item->name != NULL; ++item) { + it = g_hash_table_lookup(table->priv->colors, item->name); + gm_options_set(table->priv->options, item->name, it->hex); + } } } - // Store value in the options, set value in the table - gm_options_set(table->priv->options, name, hex); + if (table->priv->options) { + // Store value in the options, set value in the table + gm_options_set(table->priv->options, name, hex); + } + gm_color_table_set_value(table, name, hex); } @@ -442,8 +450,10 @@ gm_color_table_set_font_description(GmColorTable *table, fd = g_strdup(font_description); } - gm_options_set(table->priv->options, "font_family", - fd); + if (table->priv->options) { + gm_options_set(table->priv->options, "font_family", + fd); + } if (table->priv->font_description == NULL || strcmp(table->priv->font_description, fd) != 0) { @@ -471,10 +481,15 @@ gm_color_table_set_use_system_font(GmColorTable *table, gm_color_table_connect_font_changed(table); gm_color_table_set_font_description(table, NULL); - gm_options_set(table->priv->options, "use_system_font", "1"); + if (table->priv->options) { + gm_options_set(table->priv->options, "use_system_font", "1"); + } } else { gm_color_table_disconnect_font_changed(table); - gm_options_set(table->priv->options, "use_system_font", "0"); + + if (table->priv->options) { + gm_options_set(table->priv->options, "use_system_font", "0"); + } } } @@ -496,7 +511,7 @@ gm_color_table_load_scheme(GmColorTable *table, GmOptions *options = table->priv->options; gchar const *value; - if (scheme == SCHEME_USER) { + if (scheme == SCHEME_USER && options) { values = scheme_names[SCHEME_DEFAULT].values; while (values[i].name != NULL) { @@ -511,7 +526,7 @@ gm_color_table_load_scheme(GmColorTable *table, ++i; } - } else { + } else if (scheme != SCHEME_USER) { values = scheme_names[scheme].values; while (values[i].name != NULL) { @@ -538,9 +553,11 @@ gm_color_table_set_from_scheme_name(GmColorTable *table, gchar const *scheme) { if (scheme_names[i].name == NULL) { gm_color_table_load_scheme(table, SCHEME_DEFAULT); - gm_options_set(table->priv->options, "color_scheme", - "default"); - } else { + if (table->priv->options) { + gm_options_set(table->priv->options, "color_scheme", + "default"); + } + } else if (table->priv->options) { gm_options_set(table->priv->options, "color_scheme", scheme_names[i].name); } diff --git a/gnoemoe/gm-pixbuf.c b/gnoemoe/gm-pixbuf.c index 1b0d2be..484e01a 100644 --- a/gnoemoe/gm-pixbuf.c +++ b/gnoemoe/gm-pixbuf.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include #endif #include diff --git a/gnoemoe/gm-scripts.c b/gnoemoe/gm-scripts.c index 720ad39..f1adb58 100644 --- a/gnoemoe/gm-scripts.c +++ b/gnoemoe/gm-scripts.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -11,6 +15,12 @@ #include #include +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION + #include "gm-support.h" #include "gm-debug.h" #include "gm-world.h" diff --git a/gnoemoe/gm-support.c b/gnoemoe/gm-support.c index dc305e4..71001dc 100644 --- a/gnoemoe/gm-support.c +++ b/gnoemoe/gm-support.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include #endif #include diff --git a/gnoemoe/gm-world.c b/gnoemoe/gm-world.c index 47f9f40..9034262 100644 --- a/gnoemoe/gm-world.c +++ b/gnoemoe/gm-world.c @@ -11,7 +11,6 @@ #include "gm-triggers.h" #include "gm-marshal.h" #include "gm-net.h" -#include "gm-bogus.h" #include "gm-support.h" #include "gm-debug.h" @@ -299,6 +298,7 @@ gm_world_init(GmWorld *world) { world->priv = GM_WORLD_GET_PRIVATE(world); gm_world_create_default_settings(world); + world->priv->path = NULL; world->priv->loaded = FALSE; world->priv->history = NULL;