Exemple #1
0
/**
 * Function called when vimb enters the normal mode.
 */
void normal_enter(Client *c)
{
    /* Make sure that when the browser area becomes visible, it will get mouse
     * and keyboard events */
    gtk_widget_grab_focus(GTK_WIDGET(c->webview));
    hints_clear(c);
}
Exemple #2
0
/**
 * Called when the command mode is left.
 */
void ex_leave(void)
{
    completion_clean();
    hints_clear();
}
Exemple #3
0
gboolean start_new_game (gchar *game_filename, gchar *graphics_filename,
			 gchar *splash_filename, gchar *music_filename,
			 gchar *hints_filename)
{
    const gchar *filters[] =
	{
	    "Magnetic Scrolls data file (*.mag)", "*.mag",
	    NULL
	};

    if (!game_filename)
	game_filename = file_selector (FALSE, NULL, filters, "Open game file");

    if (!game_filename)
	return TRUE;

    stop_main_loop ();

    if (ms_is_running ())
    {
	ms_stop ();
	ms_freemem ();
    }

    stop_recording (TRUE);
    stop_scripting (TRUE);
    stop_replaying (TRUE);

    if (!graphics_filename)
	graphics_filename = change_file_extension (game_filename, "gfx");

    if (!splash_filename)
	splash_filename = change_file_extension (game_filename, "png");
    
    if (!music_filename)
	music_filename = change_file_extension (game_filename, "mp3");

    if (!hints_filename)
	hints_filename = change_file_extension (game_filename, "hnt");

    display_splash_screen (splash_filename, music_filename);

    text_clear ();
    graphics_clear ();
    hints_clear ();

    if (applicationExiting)
	return FALSE;

    if (!ms_init ((type8s *) game_filename, (type8s *) graphics_filename, (type8s *) hints_filename), NULL)
    {
	GtkWidget *error;
	gchar *basename;
	
	basename = g_path_get_basename (game_filename);
	error = gtk_message_dialog_new (
	    GTK_WINDOW (Gui.main_window),
	    GTK_DIALOG_DESTROY_WITH_PARENT,
	    GTK_MESSAGE_ERROR,
	    GTK_BUTTONS_OK,
	    "Could not start the game! The most likely cause is\n"
	    "that '%s' is not a valid game file.",
	    basename);
	gtk_dialog_run (GTK_DIALOG (error));
	g_free (basename);
	gtk_widget_destroy (error);
    } else
	start_main_loop ();
    
    g_free (game_filename);
    g_free (graphics_filename);
    g_free (splash_filename);
    g_free (music_filename);
    g_free (hints_filename);
    
    gtk_widget_grab_focus (Gui.text_view);
    return TRUE;
}