dist_pkgdata_DATA = chimara.ui chimara.menus style.css
bin_PROGRAMS = chimara
-chimara_SOURCES = main.c callbacks.c preferences.c preferences.h error.c error.h
+chimara_SOURCES = main.c \
+ callbacks.c \
+ preferences.c preferences.h \
+ error.c error.h \
+ player.c player.h
chimara_CPPFLAGS = $(AM_CPPFLAGS) \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
#include <libchimara/chimara-if.h>
#include <config.h>
#include "error.h"
+#include "player.h"
/* If a game is running in @glk, warn the user that they will quit the currently
running game if they open a new one. Returns TRUE if no game was running.
}
void
-on_open_activate(GtkAction *action, ChimaraGlk *glk)
+on_open_activate(GtkAction *action, ChimaraPlayer *player)
{
- GtkWindow *window = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(glk)));
-
- if(!confirm_open_new_game(glk))
+ if(!confirm_open_new_game(CHIMARA_GLK(player->glk)))
return;
GtkWidget *dialog = gtk_file_chooser_dialog_new(_("Open Game"),
- window,
+ GTK_WINDOW(player),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
/* Get last opened path */
- extern GSettings *state_settings;
- gchar *path;
- g_settings_get(state_settings, "last-open-path", "ms", &path);
- if(path) {
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
- g_free(path);
- }
+ //extern GSettings *state_settings;
+ //gchar *path;
+ //g_settings_get(state_settings, "last-open-path", "ms", &path);
+ //if(path) {
+ // gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
+ // g_free(path);
+ //}
if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
GError *error = NULL;
extern GSettings *prefs_settings;
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- search_for_graphics_file(filename, CHIMARA_IF(glk));
- if(!chimara_if_run_game(CHIMARA_IF(glk), filename, &error)) {
- error_dialog(window, error, _("Could not open game file '%s': "), filename);
+ search_for_graphics_file(filename, CHIMARA_IF(player->glk));
+ if(!chimara_if_run_game(CHIMARA_IF(player->glk), filename, &error)) {
+ error_dialog(GTK_WINDOW(player), error, _("Could not open game file '%s': "), filename);
g_free(filename);
gtk_widget_destroy(dialog);
return;
}
- path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog));
- if(path) {
- g_settings_set(state_settings, "last-open-path", "ms", path);
- g_free(path);
- }
+ //path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog));
+ //if(path) {
+ // g_settings_set(state_settings, "last-open-path", "ms", path);
+ // g_free(path);
+ //}
/* Add file to recent files list */
GtkRecentManager *manager = gtk_recent_manager_get_default();
}
void
-on_recent_item_activated(GtkRecentChooser *chooser, ChimaraGlk *glk)
+on_recent_item_activated(GtkRecentChooser *chooser, ChimaraPlayer *player)
{
GError *error = NULL;
- GtkWindow *window = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(glk)));
gchar *uri = gtk_recent_chooser_get_current_uri(chooser);
gchar *filename;
if(!(filename = g_filename_from_uri(uri, NULL, &error))) {
- error_dialog(window, error, _("Could not open game file '%s': "), uri);
+ error_dialog(GTK_WINDOW(player), error, _("Could not open game file '%s': "), uri);
goto finally;
}
- if(!confirm_open_new_game(glk))
+ if(!confirm_open_new_game(CHIMARA_GLK(player->glk)))
goto finally2;
- search_for_graphics_file(filename, CHIMARA_IF(glk));
- if(!chimara_if_run_game(CHIMARA_IF(glk), filename, &error)) {
- error_dialog(window, error, _("Could not open game file '%s': "), filename);
+ search_for_graphics_file(filename, CHIMARA_IF(player->glk));
+ if(!chimara_if_run_game(CHIMARA_IF(player->glk), filename, &error)) {
+ error_dialog(GTK_WINDOW(player), error, _("Could not open game file '%s': "), filename);
goto finally2;
}
}
void
-on_stop_activate(GtkAction *action, ChimaraGlk *glk)
+on_stop_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_stop(glk);
+ chimara_glk_stop(CHIMARA_GLK(player->glk));
}
void
-on_quit_chimara_activate(GtkAction *action, ChimaraGlk *glk)
+on_quit_chimara_activate(GtkAction *action, ChimaraPlayer *player)
{
gtk_main_quit();
}
void
-on_copy_activate(GtkAction *action, ChimaraGlk *glk)
+on_copy_activate(GtkAction *action, ChimaraPlayer *player)
{
- GtkWindow *toplevel = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(glk)));
- GtkWidget *focus = gtk_window_get_focus(toplevel);
+ GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(player));
/* Call "copy clipboard" on any widget that defines it */
if(GTK_IS_LABEL(focus) || GTK_IS_ENTRY(focus) || GTK_IS_TEXT_VIEW(focus))
g_signal_emit_by_name(focus, "copy-clipboard");
}
void
-on_paste_activate(GtkAction *action, ChimaraGlk *glk)
+on_paste_activate(GtkAction *action, ChimaraPlayer *player)
{
- GtkWindow *toplevel = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(glk)));
- GtkWidget *focus = gtk_window_get_focus(toplevel);
+ GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(player));
/* Call "paste clipboard" on any widget that defines it */
if(GTK_IS_ENTRY(focus) || GTK_IS_TEXT_VIEW(focus))
g_signal_emit_by_name(focus, "paste-clipboard");
}
void
-on_preferences_activate(GtkAction *action, ChimaraGlk *glk)
+on_preferences_activate(GtkAction *action, ChimaraPlayer *player)
{
- extern GtkWidget *prefswindow;
- gtk_window_present(GTK_WINDOW(prefswindow));
+ //extern GtkWidget *prefswindow;
+ //gtk_window_present(GTK_WINDOW(prefswindow));
}
void
-on_toolbar_toggled(GtkToggleAction *action, ChimaraGlk *glk)
+on_toolbar_toggled(GtkToggleAction *action, ChimaraPlayer *player)
{
- extern GtkWidget *toolbar;
-
if(gtk_toggle_action_get_active(action))
- gtk_widget_show(toolbar);
+ gtk_widget_show(player->toolbar);
else
- gtk_widget_hide(toolbar);
+ gtk_widget_hide(player->toolbar);
}
void
-on_undo_activate(GtkAction *action, ChimaraGlk *glk)
+on_undo_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_feed_line_input(glk, "undo");
+ chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "undo");
}
void
-on_save_activate(GtkAction *action, ChimaraGlk *glk)
+on_save_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_feed_line_input(glk, "save");
+ chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "save");
}
void
-on_restore_activate(GtkAction *action, ChimaraGlk *glk)
+on_restore_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_feed_line_input(glk, "restore");
+ chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "restore");
}
void
-on_restart_activate(GtkAction *action, ChimaraGlk *glk)
+on_restart_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_feed_line_input(glk, "restart");
+ chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "restart");
}
void
-on_quit_activate(GtkAction *action, ChimaraGlk *glk)
+on_quit_activate(GtkAction *action, ChimaraPlayer *player)
{
- chimara_glk_feed_line_input(glk, "quit");
+ chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "quit");
}
void
-on_about_activate(GtkAction *action, ChimaraGlk *glk)
+on_about_activate(GtkAction *action, ChimaraPlayer *player)
{
extern GtkWidget *aboutwindow;
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(aboutwindow), PACKAGE_VERSION);
}
gboolean
-on_window_delete_event(GtkWidget *widget, GdkEvent *event, ChimaraGlk *glk)
+on_window_delete_event(GtkWidget *widget, GdkEvent *event, ChimaraPlayer *player)
{
gtk_main_quit();
return TRUE;
#include <libchimara/chimara-if.h>
#include "preferences.h"
+#include "player.h"
+
-/* Static global pointers to widgets */
-static GtkUIManager *uimanager = NULL;
-static GtkWidget *window = NULL;
-static GtkWidget *glk = NULL;
/* Global global pointers */
GtkBuilder *builder = NULL;
GtkWidget *aboutwindow = NULL;
GtkWidget *prefswindow = NULL;
-GtkWidget *toolbar = NULL;
+
GSettings *prefs_settings = NULL;
GSettings *state_settings = NULL;
-GObject *
+static GObject *
load_object(const gchar *name)
{
GObject *retval;
return retval;
}
-static void
-change_window_title(ChimaraGlk *glk, GParamSpec *pspec, GtkWindow *window)
-{
- gchar *program_name, *story_name, *title;
- g_object_get(glk, "program-name", &program_name, "story-name", &story_name, NULL);
- if(!program_name) {
- gtk_window_set_title(window, "Chimara");
- return;
- }
- else if(!story_name)
- title = g_strdup_printf("%s - Chimara", program_name);
- else
- title = g_strdup_printf("%s - %s - Chimara", program_name, story_name);
-
- g_free(program_name);
- g_free(story_name);
- gtk_window_set_title(window, title);
- g_free(title);
-}
-
static void
create_window(void)
{
GError *error = NULL;
- builder = gtk_builder_new();
+ builder = gtk_builder_new();
if( !gtk_builder_add_from_file(builder, PACKAGE_DATA_DIR "/chimara.ui", &error) ) {
#ifdef DEBUG
g_error_free(error);
#endif /* DEBUG */
}
- window = GTK_WIDGET(load_object("chimara"));
aboutwindow = GTK_WIDGET(load_object("aboutwindow"));
prefswindow = GTK_WIDGET(load_object("prefswindow"));
- GtkActionGroup *actiongroup = GTK_ACTION_GROUP(load_object("actiongroup"));
-
- /* Set the default value of the "View/Toolbar" menu item upon creation of a
- new window to the "show-toolbar-default" setting, but bind the setting
- one-way only - we don't want toolbars to disappear suddenly */
- GtkToggleAction *toolbar_action = GTK_TOGGLE_ACTION(load_object("toolbar"));
- gtk_toggle_action_set_active(toolbar_action, g_settings_get_boolean(state_settings, "show-toolbar-default"));
- g_settings_bind(state_settings, "show-toolbar-default", toolbar_action, "active", G_SETTINGS_BIND_SET);
const gchar **ptr;
GtkRecentFilter *filter = gtk_recent_filter_new();
GtkRecentChooser *recent = GTK_RECENT_CHOOSER(load_object("recent"));
gtk_recent_chooser_add_filter(recent, filter);
- uimanager = gtk_ui_manager_new();
- if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_DATA_DIR "/chimara.menus", &error) ) {
-#ifdef DEBUG
- g_error_free(error);
- error = NULL;
- if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_SRC_DIR "/chimara.menus", &error) ) {
-#endif /* DEBUG */
- error_dialog(NULL, error, "Error while building interface: ");
- return;
-#ifdef DEBUG
- }
-#endif /* DEBUG */
- }
-
- glk = chimara_if_new();
- g_object_set(glk,
- "ignore-errors", TRUE,
- /*"interpreter-number", CHIMARA_IF_ZMACHINE_TANDY_COLOR,*/
- NULL);
- if( !chimara_glk_set_css_from_file(CHIMARA_GLK(glk), PACKAGE_DATA_DIR "/style.css", &error) ) {
-#ifdef DEBUG
- g_error_free(error);
- error = NULL;
- if( !chimara_glk_set_css_from_file(CHIMARA_GLK(glk), PACKAGE_SRC_DIR "/style.css", &error) ) {
-#endif /* DEBUG */
- error_dialog(NULL, error, "Couldn't open CSS file: ");
- return;
-#ifdef DEBUG
- }
-#endif /* DEBUG */
- }
-
- /* DON'T UNCOMMENT THIS your eyes will burn
- but it is a good test of programmatically altering just one style
- chimara_glk_set_css_from_string(CHIMARA_GLK(glk),
- "buffer.normal { font-family: 'Comic Sans MS'; }");*/
-
- GtkBox *vbox = GTK_BOX( gtk_builder_get_object(builder, "vbox") );
- if(vbox == NULL)
- {
- error_dialog(NULL, NULL, "Could not find vbox");
- return;
- }
-
- gtk_ui_manager_insert_action_group(uimanager, actiongroup, 0);
- GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/menubar");
- toolbar = gtk_ui_manager_get_widget(uimanager, "/toolbar");
- gtk_widget_set_no_show_all(toolbar, TRUE);
- if(gtk_toggle_action_get_active(toolbar_action))
- gtk_widget_show(toolbar);
- else
- gtk_widget_hide(toolbar);
-
- /* Connect the accelerators */
- GtkAccelGroup *accels = gtk_ui_manager_get_accel_group(uimanager);
- gtk_window_add_accel_group(GTK_WINDOW(window), accels);
-
- gtk_box_pack_end(vbox, glk, TRUE, TRUE, 0);
- gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0);
- gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0);
-
- gtk_builder_connect_signals(builder, glk);
- g_signal_connect(glk, "notify::program-name", G_CALLBACK(change_window_title), window);
- g_signal_connect(glk, "notify::story-name", G_CALLBACK(change_window_title), window);
-
/* Create preferences window */
- preferences_create(CHIMARA_GLK(glk));
+ preferences_create();
}
int
g_free(keyfile);
create_window();
- gtk_widget_show_all(window);
- g_object_unref( G_OBJECT(uimanager) );
+ GtkWidget *window = chimara_player_new();
+ gtk_widget_show_all(window);
- if(argc == 3) {
- g_object_set(glk, "graphics-file", argv[2], NULL);
- }
- if(argc >= 2) {
- if( !chimara_if_run_game(CHIMARA_IF(glk), argv[1], &error) ) {
- error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
- return 1;
- }
- }
+ //if(argc == 3) {
+ // g_object_set(glk, "graphics-file", argv[2], NULL);
+ //}
+ //if(argc >= 2) {
+ // if( !chimara_if_run_game(CHIMARA_IF(glk), argv[1], &error) ) {
+ // error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
+ // return 1;
+ // }
+ //}
gdk_threads_enter();
gtk_main();
gdk_threads_leave();
- chimara_glk_stop(CHIMARA_GLK(glk));
- chimara_glk_wait(CHIMARA_GLK(glk));
-
- g_object_unref( G_OBJECT(builder) );
-
return 0;
}
--- /dev/null
+#include <glib-object.h>
+#include <libchimara/chimara-glk.h>
+#include <libchimara/chimara-if.h>
+#include "player.h"
+#include "error.h"
+
+typedef struct _ChimaraPlayerPrivate {
+ int dummy;
+} ChimaraPlayerPrivate;
+
+#define CHIMARA_PLAYER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), CHIMARA_TYPE_PLAYER, ChimaraPlayerPrivate))
+#define CHIMARA_PLAYER_USE_PRIVATE ChimaraPlayerPrivate *priv = CHIMARA_PLAYER_PRIVATE(self)
+
+G_DEFINE_TYPE(ChimaraPlayer, chimara_player, GTK_TYPE_WINDOW);
+
+static GObject *
+load_object(GtkBuilder *builder, const gchar *name)
+{
+ GObject *retval;
+ if( (retval = gtk_builder_get_object(builder, name)) == NULL) {
+ error_dialog(NULL, NULL, "Error while getting object '%s'", name);
+ g_error("Error while getting object '%s'", name);
+ }
+ return retval;
+}
+
+static void
+change_window_title(ChimaraGlk *glk, GParamSpec *pspec, GtkWindow *window)
+{
+ gchar *program_name, *story_name, *title;
+ g_object_get(glk, "program-name", &program_name, "story-name", &story_name, NULL);
+ if(!program_name) {
+ gtk_window_set_title(window, "Chimara");
+ return;
+ }
+ else if(!story_name)
+ title = g_strdup_printf("%s - Chimara", program_name);
+ else
+ title = g_strdup_printf("%s - %s - Chimara", program_name, story_name);
+
+ g_free(program_name);
+ g_free(story_name);
+ gtk_window_set_title(window, title);
+ g_free(title);
+}
+
+static void
+chimara_player_dispose(GObject *object)
+{
+ ChimaraPlayer *self = CHIMARA_PLAYER(object);
+ if(chimara_glk_get_running(CHIMARA_GLK(self->glk))) {
+ chimara_glk_stop(CHIMARA_GLK(self->glk));
+ g_printerr("Stopping...\n");
+ chimara_glk_wait(CHIMARA_GLK(self->glk));
+ g_printerr("Done Waiting\n");
+ }
+
+ /* Chain up */
+ G_OBJECT_CLASS(chimara_player_parent_class)->dispose(object);
+}
+
+static void
+chimara_player_finalize(GObject *object)
+{
+ g_printerr("Unreffing\n");
+ g_object_unref(CHIMARA_PLAYER(object)->glk);
+
+ /* Chain up */
+ G_OBJECT_CLASS(chimara_player_parent_class)->finalize(object);
+}
+
+static void
+chimara_player_class_init(ChimaraPlayerClass *klass)
+{
+ /* Override methods of parent classes */
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ //object_class->set_property = chimara_if_set_property;
+ //object_class->get_property = chimara_if_get_property;
+ object_class->dispose = chimara_player_dispose;
+ object_class->finalize = chimara_player_finalize;
+
+ /* Signals */
+
+ /* Properties */
+
+ /* Private data */
+ g_type_class_add_private(klass, sizeof(ChimaraPlayerPrivate));
+}
+
+static void
+chimara_player_init(ChimaraPlayer *self)
+{
+ GError *error = NULL;
+
+ GtkBuilder *builder = gtk_builder_new();
+ char *object_ids[] = {
+ "actiongroup",
+ "vbox",
+ NULL
+ };
+
+ if( !gtk_builder_add_objects_from_file(builder, PACKAGE_DATA_DIR "/chimara.ui", object_ids, &error) ) {
+#ifdef DEBUG
+ g_error_free(error);
+ error = NULL;
+ if( !gtk_builder_add_objects_from_file(builder, PACKAGE_SRC_DIR "/chimara.ui", object_ids, &error) ) {
+#endif /* DEBUG */
+ error_dialog(NULL, error, "Error while building interface: ");
+ return;
+#ifdef DEBUG
+ }
+#endif /* DEBUG */
+ }
+
+ GtkActionGroup *actiongroup = GTK_ACTION_GROUP(load_object(builder, "actiongroup"));
+
+ /* Set the default value of the "View/Toolbar" menu item upon creation of a
+ new window to the "show-toolbar-default" setting, but bind the setting
+ one-way only - we don't want toolbars to disappear suddenly */
+ GtkToggleAction *toolbar_action = GTK_TOGGLE_ACTION(load_object(builder, "toolbar"));
+ //gtk_toggle_action_set_active(toolbar_action, g_settings_get_boolean(state_settings, "show-toolbar-default"));
+ //g_settings_bind(state_settings, "show-toolbar-default", toolbar_action, "active", G_SETTINGS_BIND_SET);
+
+ GtkUIManager *uimanager = gtk_ui_manager_new();
+ if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_DATA_DIR "/chimara.menus", &error) ) {
+#ifdef DEBUG
+ g_error_free(error);
+ error = NULL;
+ if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_SRC_DIR "/chimara.menus", &error) ) {
+#endif /* DEBUG */
+ error_dialog(NULL, error, "Error while building interface: ");
+ return;
+#ifdef DEBUG
+ }
+#endif /* DEBUG */
+ }
+
+ self->glk = chimara_if_new();
+ g_object_set(self->glk,
+ "ignore-errors", TRUE,
+ /*"interpreter-number", CHIMARA_IF_ZMACHINE_TANDY_COLOR,*/
+ NULL);
+ if( !chimara_glk_set_css_from_file(CHIMARA_GLK(self->glk), PACKAGE_DATA_DIR "/style.css", &error) ) {
+#ifdef DEBUG
+ g_error_free(error);
+ error = NULL;
+ if( !chimara_glk_set_css_from_file(CHIMARA_GLK(self->glk), PACKAGE_SRC_DIR "/style.css", &error) ) {
+#endif /* DEBUG */
+ error_dialog(NULL, error, "Couldn't open CSS file: ");
+ return;
+#ifdef DEBUG
+ }
+#endif /* DEBUG */
+ }
+
+ /* DON'T UNCOMMENT THIS your eyes will burn
+ but it is a good test of programmatically altering just one style
+ chimara_glk_set_css_from_string(CHIMARA_GLK(glk),
+ "buffer.normal { font-family: 'Comic Sans MS'; }");*/
+
+ GtkBox *vbox = GTK_BOX(load_object(builder, "vbox"));
+
+ gtk_ui_manager_insert_action_group(uimanager, actiongroup, 0);
+ GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/menubar");
+ self->toolbar = gtk_ui_manager_get_widget(uimanager, "/toolbar");
+ gtk_widget_set_no_show_all(self->toolbar, TRUE);
+ if(gtk_toggle_action_get_active(toolbar_action))
+ gtk_widget_show(self->toolbar);
+ else
+ gtk_widget_hide(self->toolbar);
+
+ /* Connect the accelerators */
+ GtkAccelGroup *accels = gtk_ui_manager_get_accel_group(uimanager);
+ gtk_window_add_accel_group(GTK_WINDOW(self), accels);
+
+ gtk_box_pack_end(vbox, self->glk, TRUE, TRUE, 0);
+ g_object_ref(self->glk); /* add an extra reference to keep it alive while
+ the Glk program shuts down */
+ gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0);
+ gtk_box_pack_start(vbox, self->toolbar, FALSE, FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(vbox));
+
+ gtk_builder_connect_signals(builder, self);
+ g_signal_connect(self->glk, "notify::program-name", G_CALLBACK(change_window_title), self);
+ g_signal_connect(self->glk, "notify::story-name", G_CALLBACK(change_window_title), self);
+
+ g_object_unref( G_OBJECT(builder) );
+ g_object_unref( G_OBJECT(uimanager) );
+}
+
+/* PUBLIC FUNCTIONS */
+
+GtkWidget *
+chimara_player_new(void)
+{
+ return GTK_WIDGET(g_object_new(CHIMARA_TYPE_PLAYER,
+ "type", GTK_WINDOW_TOPLEVEL,
+ NULL));
+}
\ No newline at end of file
--- /dev/null
+#ifndef __PLAYER_H__
+#define __PLAYER_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CHIMARA_TYPE_PLAYER (chimara_player_get_type())
+#define CHIMARA_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CHIMARA_TYPE_PLAYER, ChimaraPlayer))
+#define CHIMARA_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CHIMARA_TYPE_PLAYER, ChimaraPlayerClass))
+#define CHIMARA_IS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHIMARA_TYPE_PLAYER))
+#define CHIMARA_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CHIMARA_TYPE_PLAYER))
+#define CHIMARA_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CHIMARA_TYPE_PLAYER, ChimaraPlayerClass))
+
+typedef struct _ChimaraPlayer {
+ GtkWindow parent_instance;
+
+ /* Public pointers to widgets */
+ GtkWidget *glk, *toolbar;
+} ChimaraPlayer;
+
+typedef struct _ChimaraPlayerClass {
+ GtkWindowClass parent_class;
+} ChimaraPlayerClass;
+
+GType chimara_player_get_type(void) G_GNUC_CONST;
+GtkWidget *chimara_player_new(void);
+
+G_END_DECLS
+
+#endif /* __PLAYER_H__ */
\ No newline at end of file
static GtkTextTag *current_tag;
static GtkListStore *preferred_list;
-static void style_tree_select_callback(GtkTreeSelection *selection, ChimaraGlk *glk);
+static void style_tree_select_callback(GtkTreeSelection *selection);
/* Internal functions to convert from human-readable names in the config file
to enums and back. Later: replace with plugin functions. */
/* Create the preferences dialog. */
void
-preferences_create(ChimaraGlk *glk)
+preferences_create(void)
{
+#if 0
/* Initialize the tree of style names */
GtkTreeStore *style_list = GTK_TREE_STORE( load_object("style-list") );
GtkTreeIter buffer, grid, buffer_child, grid_child;
GtkTreeView *view = GTK_TREE_VIEW( load_object("style-treeview") );
GtkTreeSelection *selection = gtk_tree_view_get_selection(view);
gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
- g_signal_connect(selection, "changed", G_CALLBACK(style_tree_select_callback), glk);
+ g_signal_connect(selection, "changed", G_CALLBACK(style_tree_select_callback), NULL);
/* Bind the preferences to the entries in the preferences file */
extern GSettings *prefs_settings;
1, interpreter_to_display_string(chimara_if_get_preferred_interpreter(CHIMARA_IF(glk), count)),
-1);
}
+#endif
}
static void
-style_tree_select_callback(GtkTreeSelection *selection, ChimaraGlk *glk)
+style_tree_select_callback(GtkTreeSelection *selection)
{
GtkTreeIter child, parent;
gchar *child_name, *parent_name;
return;
gtk_tree_model_get(model, &parent, 0, &parent_name, -1);
- if( !strcmp(parent_name, "Text buffer") )
- current_tag = chimara_glk_get_tag(glk, CHIMARA_GLK_TEXT_BUFFER, child_name);
- else
- current_tag = chimara_glk_get_tag(glk, CHIMARA_GLK_TEXT_GRID, child_name);
+ //if( !strcmp(parent_name, "Text buffer") )
+ // current_tag = chimara_glk_get_tag(glk, CHIMARA_GLK_TEXT_BUFFER, child_name);
+ //else
+ // current_tag = chimara_glk_get_tag(glk, CHIMARA_GLK_TEXT_GRID, child_name);
}
void
#ifndef PREFERENCES_H
#define PREFERENCES_H
-#include <gtk/gtk.h>
-#include <libchimara/chimara-glk.h>
+#include <glib.h>
-G_GNUC_INTERNAL void preferences_create(ChimaraGlk *glk);
+G_GNUC_INTERNAL void preferences_create(void);
#endif