From: P. F. Chimento Date: Tue, 21 Jun 2011 07:24:22 +0000 (+0200) Subject: Get GUI mostly working again X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=7207e1f541962bb37387f336ece5e80f47372903;hp=26b4a5702f46292203593985928faadab95c7a18;p=projects%2Fchimara%2Fchimara.git Get GUI mostly working again Add the window properties to the initializers, properly construct the windows from the Glade file --- diff --git a/player/chimara.ui b/player/chimara.ui index 84e6d95..fa62cc7 100644 --- a/player/chimara.ui +++ b/player/chimara.ui @@ -233,20 +233,11 @@ Philip Chimento - + + True False - Chimara - 600 - 800 - - - True - False - - - - + @@ -257,722 +248,667 @@ Philip Chimento - - False - 5 - Chimara Preferences - center - dialog - - - - + + True + True + + True False - 9 - - + 6 + 6 + + True False - end + 0 + none - - gtk-close + True - True - True - False - True - + False + 12 + + + Turn on _flepping + True + True + False + Whether to flep or not when gronking a bloop. + False + True + True + + + + + + + True + False + <b>General settings</b> + True - - False - False - 0 - False - True - end + False 0 - + + + + + + + + + + True + False + Environment + + + False + + + + + True + False + 6 + 6 + + True - True + False + 2 - + True False - 6 - 6 - - - True - False - 0 - none - - - True - False - 12 - - - Turn on _flepping - True - True - False - Whether to flep or not when gronking a bloop. - False - True - True - - - - - - - True - False - <b>General settings</b> - True - - - - - False - False - 0 - - - - - - - - + 1 + 5 + Load layout from this CSS file: + + GTK_FILL + - - + + + 250 + True + False + Select A CSS File + + + + 1 + 2 + + + + + False + True + 0 + + + + + True + False + + + False + True + 5 + 1 + + + + + True + False + + True False - Environment + 0 + 5 + Select a style to edit: - False + False + True + 0 - + True False - 6 - 6 + 12 - + + 163 True - False - 2 + True + never + automatic - + True - False - 1 - 5 - Load layout from this CSS file: + False + True + style-list + False + False + + + Style Name + True + + + + 0 + + + + - - GTK_FILL - - - - - 250 - True - False - Select A CSS File - - - - 1 - 2 - - False + True True 0 - - True - False - - - False - True - 5 - 1 - - - - + True False + 6 - + True False - 0 - 5 - Select a style to edit: + 3 + 2 + 6 + 6 + + + True + False + 0 + Font: + + + GTK_FILL + + + + + True + True + False + + + + 1 + 2 + GTK_FILL + + + + + True + False + 0 + Foreground color: + + + 1 + 2 + GTK_FILL + + + + + 40 + 30 + True + False + True + True + False + #000000000000 + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + Background color: + + + 2 + 3 + GTK_FILL + + + + + 40 + 30 + True + False + True + True + False + #ffffffffffff + + + + 1 + 2 + 2 + 3 + GTK_FILL + + - False + True True 0 - + True False - 12 + 6 + start - - 163 + + gtk-justify-left True + False True - never - automatic - - - True - False - True - style-list - False - False - - - Style Name - True - - - - 0 - - - - - - + False + False + True + top + True + False + - True - True + False + False 0 - + + gtk-justify-center True - False - 6 - - - True - False - 3 - 2 - 6 - 6 - - - True - False - 0 - Font: - - - GTK_FILL - - - - - True - True - False - - - - 1 - 2 - GTK_FILL - - - - - True - False - 0 - Foreground color: - - - 1 - 2 - GTK_FILL - - - - - 40 - 30 - True - False - True - True - False - #000000000000 - - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - False - 0 - Background color: - - - 2 - 3 - GTK_FILL - - - - - 40 - 30 - True - False - True - True - False - #ffffffffffff - - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - True - 0 - - - - - True - False - 6 - start - - - gtk-justify-left - True - False - True - False - False - True - top - True - False - - - - False - False - 0 - - - - - gtk-justify-center - True - False - True - False - False - True - top - False - left - - - - False - False - 1 - - - - - gtk-justify-right - True - False - True - False - False - True - top - False - left - - - - False - False - 2 - - - - - gtk-justify-fill - True - False - True - False - False - True - top - False - left - - - - False - True - 3 - - - - - True - True - 1 - - - - - True - False - 6 - start - - - gtk-bold - True - False - True - False - False - True - top - False - - - - False - False - 0 - - - - - gtk-italic - True - False - True - False - False - True - top - False - - - - False - False - 1 - - - - - gtk-underline - True - False - True - False - False - True - top - False - - - - False - False - 2 - - - - - True - True - 2 - - + False + True + False + False + True + top + False + left + - True - True + False + False 1 + + + gtk-justify-right + True + False + True + False + False + True + top + False + left + + + + False + False + 2 + + + + + gtk-justify-fill + True + False + True + False + False + True + top + False + left + + + + False + True + 3 + + True True - 5 1 + + + True + False + 6 + start + + + gtk-bold + True + False + True + False + False + True + top + False + + + + False + False + 0 + + + + + gtk-italic + True + False + True + False + False + True + top + False + + + + False + False + 1 + + + + + gtk-underline + True + False + True + False + False + True + top + False + + + + False + False + 2 + + + + + True + True + 2 + + True True - 5 - 2 - - - - - 30 - True - False - 0 - 1 - 5 - Example text: - - - False - True - 3 - - - - - 100 - True - True - False - word-char - 10 - 10 - - - True - True - 4 + 1 + True + True + 5 1 - - - True - False - Layout - - - 1 - False - - + + + True + True + 5 + 2 + + + + + 30 + True + False + 0 + 1 + 5 + Example text: + + + False + True + 3 + + + + + 100 + True + True + False + word-char + 10 + 10 + + + True + True + 4 + + + + + 1 + + + + + True + False + Layout + + + 1 + False + + + + + True + False + 6 + 6 + + + True + False + 0 + none - + True False - 6 - 6 + 12 - + True - False - 0 - none + True + automatic + automatic - + True - False - 12 + True + Which interpreter to use by default for each story format + interpreters + False + True - - True - True - automatic - automatic + + Format + + + + 0 + + + + + + + Interpreter - - True - True - Which interpreter to use by default for each story format - interpreters - False - True - - - Format - - - - 0 - - - - - - - Interpreter - - - True - False - available_interpreters - 0 - - - - 1 - - - - + + True + False + available_interpreters + 0 + + + 1 + - - - True - False - <b>Preferred interpreters</b> - True - - - - - True - True - 0 - - - - - True - False - 6 - - - True - False - Look for _resource files in: - True - blorb_file_chooser - - - False - False - 0 - - - - - True - False - Where to look for Blorb resource files containing graphics and sound; normally, these are part of the story file itself, but they are provided as separate files in some older games. - select-folder - - - - True - True - 1 - - - - False - False - 1 - + + + + True + False + <b>Preferred interpreters</b> + True + + + + + True + True + 0 + + + + + True + False + 6 + + + True + False + Look for _resource files in: + True + blorb_file_chooser + - 2 + False + False + 0 - - + + True False - Interpreters + Where to look for Blorb resource files containing graphics and sound; normally, these are part of the story file itself, but they are provided as separate files in some older games. + select-folder + - 2 - False + True + True + 1 - True - True - 2 + False + False + 1 + + 2 + + + + + True + False + Interpreters + + + 2 + False + - - button-close - diff --git a/player/player.c b/player/player.c index b59da1b..0d8d629 100644 --- a/player/player.c +++ b/player/player.c @@ -1,4 +1,5 @@ #include +#include #include #include #include "player.h" @@ -92,11 +93,19 @@ static void chimara_player_init(ChimaraPlayer *self) { GError *error = NULL; - + + /* Set parent properties */ + g_object_set(self, + "title", _("Chimara"), + "default-width", 600, + "default-height", 800, + NULL); + + /* Construct user interface */ GtkBuilder *builder = gtk_builder_new(); char *object_ids[] = { "actiongroup", - "vbox", + "player-vbox", NULL }; @@ -159,7 +168,7 @@ chimara_player_init(ChimaraPlayer *self) chimara_glk_set_css_from_string(CHIMARA_GLK(glk), "buffer.normal { font-family: 'Comic Sans MS'; }");*/ - GtkBox *vbox = GTK_BOX(load_object(builder, "vbox")); + GtkBox *vbox = GTK_BOX(load_object(builder, "player-vbox")); ChimaraApp *theapp = chimara_app_get(); @@ -301,10 +310,3 @@ on_quit_activate(GtkAction *action, ChimaraPlayer *player) chimara_glk_feed_line_input(CHIMARA_GLK(player->glk), "quit"); } -gboolean -on_window_delete_event(GtkWidget *widget, GdkEvent *event, ChimaraPlayer *player) -{ - gtk_main_quit(); - return TRUE; -} - diff --git a/player/preferences.c b/player/preferences.c index 2f764a7..e03e81b 100644 --- a/player/preferences.c +++ b/player/preferences.c @@ -49,7 +49,7 @@ typedef struct _ChimaraPrefsPrivate { #define CHIMARA_PREFS_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), CHIMARA_TYPE_PREFS, ChimaraPrefsPrivate)) #define CHIMARA_PREFS_USE_PRIVATE ChimaraPrefsPrivate *priv = CHIMARA_PREFS_PRIVATE(self) -G_DEFINE_TYPE(ChimaraPrefs, chimara_prefs, GTK_TYPE_WINDOW); +G_DEFINE_TYPE(ChimaraPrefs, chimara_prefs, GTK_TYPE_DIALOG); static GtkTextTag *current_tag; static GtkListStore *preferred_list; @@ -189,11 +189,22 @@ chimara_prefs_init(ChimaraPrefs *self) { GError *error = NULL; ChimaraApp *theapp = chimara_app_get(); + + /* Set parent properties */ + g_object_set(self, + "title", _("Chimara Preferences"), + "window-position", GTK_WIN_POS_CENTER, + "type-hint", GDK_WINDOW_TYPE_HINT_DIALOG, + "border-width", 6, + NULL); + gtk_dialog_add_buttons(GTK_DIALOG(self), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); /* Build user interface */ GtkBuilder *builder = gtk_builder_new(); char *object_ids[] = { - "prefswindow", + "prefs-notebook", "available_interpreters", "interpreters", "style-list", @@ -212,6 +223,10 @@ chimara_prefs_init(ChimaraPrefs *self) } #endif /* DEBUG */ } + + GtkWidget *notebook = GTK_WIDGET( load_object(builder, "prefs-notebook") ); + GtkWidget *content_area = gtk_dialog_get_content_area( GTK_DIALOG(self) ); + gtk_container_add( GTK_CONTAINER(content_area), notebook ); /* Initialize the tree of style names */ GtkTreeStore *style_list = GTK_TREE_STORE( load_object(builder, "style-list") ); @@ -296,6 +311,13 @@ chimara_prefs_init(ChimaraPrefs *self) // 1, interpreter_to_display_string(chimara_if_get_preferred_interpreter(CHIMARA_IF(glk), count)), // -1); //} + + gtk_builder_connect_signals(builder, self); + g_object_unref(builder); + + /* Connect own signals */ + g_signal_connect(self, "response", G_CALLBACK(gtk_widget_hide), NULL); + g_signal_connect(self, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); } /* PUBLIC FUNCTIONS */ @@ -331,7 +353,6 @@ style_tree_select_callback(GtkTreeSelection *selection) // current_tag = chimara_glk_get_tag(glk, CHIMARA_GLK_TEXT_GRID, child_name); } -#if 0 void on_toggle_left(GtkToggleButton *button, ChimaraGlk *glk) { /* No nothing if the button is deactivated */ @@ -421,7 +442,6 @@ on_font_set(GtkFontButton *button, ChimaraGlk *glk) g_object_set(current_tag, "font-desc", font_description, NULL); chimara_glk_update_style(glk); } -#endif void on_css_filechooser_file_set(GtkFileChooserButton *button, ChimaraGlk *glk) diff --git a/player/preferences.h b/player/preferences.h index cf357df..144a985 100644 --- a/player/preferences.h +++ b/player/preferences.h @@ -15,13 +15,13 @@ G_BEGIN_DECLS #define CHIMARA_PREFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CHIMARA_TYPE_PREFS, ChimaraPrefsClass)) typedef struct _ChimaraPrefs { - GtkWindow parent_instance; + GtkDialog parent_instance; /* Public pointers */ } ChimaraPrefs; typedef struct _ChimaraPrefsClass { - GtkWindowClass parent_class; + GtkDialogClass parent_class; } ChimaraPrefsClass; GType chimara_prefs_get_type(void) G_GNUC_CONST;