CVSROOT: /sources/gnash Module name: gnash Changes by: Benjamin Wolsey <bwy> 08/01/18 12:19:47
Modified files: . : ChangeLog gui : gtk.cpp gtksup.h libbase : rc.cpp rc.h Log message: * libbase/rc.{h,cpp}: add methods to set whitelist, blacklist, flashVersionString, flashSystemOS, flashSystemManufacturer, startStopped, insecureSSL. Add updateFile() that decides where to write a gnashrc file (either to GNASHRC or to ~/.gnashrc, fail if neither can be found). * gui/gtk{sup.h,.cpp}: clean up movie properties dialogue, add more options to preferences dialogue. Allow saving to disk by clicking 'save'. GNASHRC=~/mytestfile gnash ... is a safe way of using this without overwriting a valuable gnashrc file. The file is only written by clicking 'Save' on the preferences dialogue in the Gtk frontend. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5429&r2=1.5430 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.133&r2=1.134 http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.59&r2=1.60 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.cpp?cvsroot=gnash&r1=1.53&r2=1.54 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.40&r2=1.41 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5429 retrieving revision 1.5430 diff -u -b -r1.5429 -r1.5430 --- ChangeLog 17 Jan 2008 23:34:37 -0000 1.5429 +++ ChangeLog 18 Jan 2008 12:19:46 -0000 1.5430 @@ -1,3 +1,14 @@ +2008-01-18 Benjamin Wolsey <[EMAIL PROTECTED]> + + * libbase/rc.{h,cpp}: add methods to set whitelist, blacklist, + flashVersionString, flashSystemOS, flashSystemManufacturer, + startStopped, insecureSSL. Add updateFile() that decides where + to write a gnashrc file (either to GNASHRC or to ~/.gnashrc, fail + if neither can be found). Document more functions. + * gui/gtk{sup.h,.cpp}: clean up movie properties dialogue, add more + options to preferences dialogue. Allow saving to disk by clicking + 'save'. + 2008-01-17 Sandro Santilli <[EMAIL PROTECTED]> * server/as_environment.cpp (find_object): don't allow dots Index: gui/gtk.cpp =================================================================== RCS file: /sources/gnash/gnash/gui/gtk.cpp,v retrieving revision 1.133 retrieving revision 1.134 diff -u -b -r1.133 -r1.134 --- gui/gtk.cpp 16 Jan 2008 17:14:04 -0000 1.133 +++ gui/gtk.cpp 18 Jan 2008 12:19:47 -0000 1.134 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: gtk.cpp,v 1.133 2008/01/16 17:14:04 bwy Exp $ */ +/* $Id: gtk.cpp,v 1.134 2008/01/18 12:19:47 bwy Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -778,9 +778,9 @@ GtkGui::updateRC (GtkWidget* dialog, gint response, gpointer data) { - if (response == GTK_RESPONSE_ACCEPT) { + if (response == GTK_RESPONSE_APPLY) { - // If 'OK' was clicked, set all the values in rcfile + // If 'Save' was clicked, set all the values in rcfile prefData *prefs = static_cast<prefData*>(data); RcInitFile& rcfile = RcInitFile::getDefaultInstance(); // For getting from const gchar* to std::string& @@ -805,8 +805,8 @@ rcfile.showASCodingErrors( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->ASCodingErrorToggle))); - //rcfile.showMalformedSWFErrors( - // gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->malformedSWFToggle))); + rcfile.showMalformedSWFErrors( + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->malformedSWFToggle))); rcfile.useLocalHost( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->localHostToggle))); @@ -829,10 +829,31 @@ tmp = gtk_entry_get_text(GTK_ENTRY(prefs->solSandbox)); rcfile.setSOLSafeDir(tmp); + tmp = gtk_entry_get_text(GTK_ENTRY(prefs->osText)); + rcfile.setFlashSystemOS(tmp); + + tmp = gtk_entry_get_text(GTK_ENTRY(prefs->versionText)); + rcfile.setFlashVersionString(tmp); + + rcfile.setMovieLibraryLimit( + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(prefs->librarySize))); + + rcfile.startStopped( + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->startStoppedToggle))); + + // Let rcfile decide which file to update: generally the file being used if + // specified in GNASHRC environment variable, or in the user's home directory + // if that can be found. + // TODO: We can also specify here which file should be written by passing + // that instead. How might that best be done? + rcfile.updateFile(); + } - // Make sure the dialogue is destroyed, whatever button is clicked. + else if (response == GTK_RESPONSE_CLOSE) { + // Close the window only when 'close' is clicked gtk_widget_destroy(dialog); + } } @@ -853,11 +874,16 @@ RcInitFile& rcfile = RcInitFile::getDefaultInstance(); // Create top-level window - GtkWidget *prefsDialog = gtk_dialog_new_with_buttons(_("Gnash preferences"), + GtkWidget *prefsDialog = gtk_dialog_new_with_buttons( + _("Gnash preferences"), GTK_WINDOW(_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + // Needs an explicit cast in C++ + GtkDialogFlags( + GTK_DIALOG_DESTROY_WITH_PARENT | + GTK_DIALOG_NO_SEPARATOR), + // The buttons and their response codes: + GTK_STOCK_SAVE, GTK_RESPONSE_APPLY, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); // Add Gnash icon addGnashIcon(GTK_WINDOW(prefsDialog)); @@ -931,6 +957,12 @@ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->ASCodingErrorToggle), rcfile.showASCodingErrors()); + prefs->lcTraceToggle = gtk_check_button_new_with_mnemonic ( + _("Log _Local Connection activity")); + gtk_box_pack_start (GTK_BOX(loggingvbox), prefs->lcTraceToggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->lcTraceToggle), + rcfile.getLCTrace()); + #ifdef USE_DEBUGGER prefs->DebuggerToggle = gtk_check_button_new_with_mnemonic ("Enable _debugger"); @@ -989,7 +1021,7 @@ gtk_box_pack_start (GTK_BOX(securityvbox), prefs->solSandbox, FALSE, FALSE, 0); prefs->solReadOnlyToggle = gtk_check_button_new_with_mnemonic ( - _("Do not _write Shared Object files")); + _("Do _not write Shared Object files")); gtk_box_pack_start (GTK_BOX(securityvbox), prefs->solReadOnlyToggle, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->solReadOnlyToggle), rcfile.getSOLReadOnly()); @@ -1006,18 +1038,12 @@ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->localConnectionToggle), rcfile.getLocalConnection()); - prefs->lcTraceToggle = gtk_check_button_new_with_mnemonic ( - _("_Trace local connection activity")); - gtk_box_pack_start (GTK_BOX(securityvbox), prefs->lcTraceToggle, FALSE, FALSE, 0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->lcTraceToggle), - rcfile.getLCTrace()); - // Sound Tab - // Security Tab + // Media Tab GtkWidget *mediavbox = gtk_vbox_new (FALSE, 2); - // Security tab title + // Media tab title GtkWidget *mediatablabel = gtk_label_new_with_mnemonic (_("_Media")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), GTK_WIDGET(mediavbox), mediatablabel); @@ -1029,9 +1055,78 @@ prefs->soundToggle = gtk_check_button_new_with_mnemonic ("Use sound _handler"); gtk_box_pack_start (GTK_BOX(mediavbox), prefs->soundToggle, FALSE, FALSE, 0); - + // Align button state with rcfile gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->soundToggle), rcfile.useSound()); + // Player Tab + GtkWidget *playervbox = gtk_vbox_new (FALSE, 14); + + // Player tab title + GtkWidget *playertablabel = gtk_label_new_with_mnemonic (_("_Player")); + + gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), GTK_WIDGET(playervbox), playertablabel); + + // Player description + GtkWidget *descriptionlabel = gtk_label_new (_("<b>Player description</b>")); + gtk_label_set_use_markup (GTK_LABEL (descriptionlabel), TRUE); + gtk_box_pack_start(GTK_BOX(playervbox), descriptionlabel, FALSE, FALSE, 0); + + // Version string + GtkWidget *versionhbox = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start(GTK_BOX(playervbox), versionhbox, FALSE, FALSE, 0); + + GtkWidget *versionlabel = gtk_label_new (_("Player version:")); + gtk_misc_set_alignment (GTK_MISC (versionlabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(versionhbox), versionlabel, FALSE, FALSE, 0); + + prefs->versionText = gtk_entry_new (); + gtk_box_pack_start(GTK_BOX(versionhbox), prefs->versionText, FALSE, FALSE, 0); + // Put text in the entry box + gtk_entry_set_text(GTK_ENTRY(prefs->versionText), rcfile.getFlashVersionString().c_str()); + + // OS label + GtkWidget *oshbox = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start(GTK_BOX(playervbox), oshbox, FALSE, FALSE, 0); + + GtkWidget *OSlabel = gtk_label_new (_("Operating system:")); + gtk_misc_set_alignment (GTK_MISC (OSlabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(oshbox), OSlabel, FALSE, FALSE, 0); + + prefs->osText = gtk_entry_new (); + gtk_box_pack_start(GTK_BOX(oshbox), prefs->osText, FALSE, FALSE, 0); + // Put text in the entry box + gtk_entry_set_text(GTK_ENTRY(prefs->osText), rcfile.getFlashSystemOS().c_str()); + + GtkWidget *OSadvicelabel = gtk_label_new (_("<i>If blank, Gnash will " + "detect your OS</i>")); + gtk_label_set_use_markup (GTK_LABEL (OSadvicelabel), TRUE); + gtk_misc_set_alignment (GTK_MISC (OSadvicelabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(playervbox), OSadvicelabel, FALSE, FALSE, 0); + + // Performance + GtkWidget *performancelabel = gtk_label_new (_("<b>Performance</b>")); + gtk_label_set_use_markup (GTK_LABEL (performancelabel), TRUE); + gtk_box_pack_start(GTK_BOX(playervbox), performancelabel, FALSE, FALSE, 0); + + // Library size + GtkWidget *libraryhbox = gtk_hbox_new (FALSE, 2); + gtk_box_pack_start(GTK_BOX(playervbox), libraryhbox, FALSE, FALSE, 0); + + GtkWidget *librarylabel = gtk_label_new (_("Max size of movie library:")); + gtk_misc_set_alignment (GTK_MISC (librarylabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(libraryhbox), librarylabel, FALSE, FALSE, 0); + + prefs->librarySize = gtk_spin_button_new_with_range(0, 100, 1); + gtk_box_pack_start(GTK_BOX(libraryhbox), prefs->librarySize, FALSE, FALSE, 0); + // Align to rcfile value: + gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs->librarySize), rcfile.getMovieLibraryLimit()); + + prefs->startStoppedToggle = gtk_check_button_new_with_mnemonic ( + _("Start _Gnash in pause mode")); + gtk_box_pack_start (GTK_BOX(playervbox), prefs->startStoppedToggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->startStoppedToggle), + rcfile.startStopped()); + gtk_widget_show_all (prefsDialog); } @@ -1039,51 +1134,38 @@ GtkGui::showPropertiesDialog() { - GtkWidget* label; - - GtkWidget* window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window1), _("Movie Properties")); - - addGnashIcon(GTK_WINDOW(window1)); - - GtkWidget *main_vbox = gtk_vbox_new(FALSE, 2); - gtk_container_add (GTK_CONTAINER (window1), main_vbox); - - GtkWidget *frame1 = gtk_frame_new(_("Movie Properties")); - gtk_box_pack_start (GTK_BOX (main_vbox), frame1, TRUE, TRUE, 0); + GtkWidget *propsDialog = gtk_dialog_new_with_buttons( + _("Movie properties"), + GTK_WINDOW(_window), + // The cast is necessary if there is more + // than one option. + GtkDialogFlags( + GTK_DIALOG_DESTROY_WITH_PARENT), + // Just a 'close' button + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); - GtkWidget *vbox1 = gtk_vbox_new (FALSE, 3); - gtk_container_add (GTK_CONTAINER (frame1), vbox1); + addGnashIcon(GTK_WINDOW(propsDialog)); - GtkWidget *vbox2 = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); + // Destroy the window when a button is clicked. + g_signal_connect (propsDialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); - GtkWidget *label_vbox2 = gtk_label_new(_("VM Properties")); - gtk_box_pack_start (GTK_BOX (vbox2), label_vbox2, FALSE, FALSE, 0); + // 2 rows: 1 for the title, 1 for the display widget (table or treeview) + GtkWidget *propsvbox = gtk_vbox_new (FALSE, 2); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(propsDialog)->vbox), propsvbox); + + GtkWidget *propslabel = gtk_label_new(_("<b>VM Properties</b>")); + gtk_label_set_use_markup (GTK_LABEL (propslabel), TRUE); + gtk_box_pack_start (GTK_BOX (propsvbox), propslabel, FALSE, FALSE, 0); GtkWidget *table1 = gtk_table_new(4, 2, FALSE); - gtk_box_pack_start (GTK_BOX (vbox2), table1, FALSE, FALSE, 0); - - - gtk_box_pack_start ( - GTK_BOX (vbox1), gtk_hseparator_new (), FALSE, FALSE, 0); - - GtkWidget *vbox3 = gtk_vbox_new (FALSE, 3); - gtk_box_pack_start ( - GTK_BOX (vbox1), vbox3, TRUE, TRUE, 0); - - GtkWidget *scrollwindow1 = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow1), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_box_pack_start ( - GTK_BOX (vbox3), scrollwindow1, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (propsvbox), table1, FALSE, FALSE, 0); std::auto_ptr<InfoTree> infoptr = getMovieInfo(); if ( ! infoptr.get() ) { - label = gtk_label_new (_("VM not initialized yet")); + GtkWidget *label = gtk_label_new (_("VM not initialized yet")); gtk_widget_show (label); gtk_table_attach_defaults (GTK_TABLE (table1), label, 0, 1, 0, 1); return; @@ -1128,13 +1210,18 @@ // Should replace table display when proper // InfoTrees are available + GtkWidget *scrollwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow1), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start ( + GTK_BOX (propsvbox), scrollwindow1, TRUE, TRUE, 0); + enum { NODENAME_COLUMN = 0, STRING1_COLUMN, - STRING2_COLUMN, - COMMENT_COLUMN, - NUM_COLUMNS + STRING2_COLUMN }; GtkTreeModel *model = makeTreeModel(infoptr); @@ -1148,7 +1235,9 @@ GtkTreeViewColumn *column; //Add columns: - //First column: + +#if 0 + // Depth column (for debugging) renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(treeview), @@ -1157,8 +1246,9 @@ NODENAME_COLUMN, NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW(treeview), col_offset - 1); +#endif - //Second column: + // 'Variable' column: renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); @@ -1169,7 +1259,7 @@ NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); - //Third column: + // 'Value' column: renderer = gtk_cell_renderer_text_new (); g_object_set (renderer, "xalign", 0.0, NULL); @@ -1186,17 +1276,7 @@ #endif } - GtkWidget *bbox1 = gtk_hbutton_box_new (); - gtk_box_pack_start ( - GTK_BOX (main_vbox), bbox1, FALSE, FALSE, 0); - - - GtkWidget *button_ok = gtk_button_new_from_stock (GTK_STOCK_OK); - gtk_box_pack_end (GTK_BOX (bbox1), button_ok, FALSE, FALSE, 0); - g_signal_connect_swapped (button_ok, "clicked", - G_CALLBACK(gtk_widget_destroy), window1); - - gtk_widget_show_all (window1); + gtk_widget_show_all (propsDialog); } Index: gui/gtksup.h =================================================================== RCS file: /sources/gnash/gnash/gui/gtksup.h,v retrieving revision 1.59 retrieving revision 1.60 diff -u -b -r1.59 -r1.60 --- gui/gtksup.h 16 Jan 2008 17:14:04 -0000 1.59 +++ gui/gtksup.h 18 Jan 2008 12:19:47 -0000 1.60 @@ -221,6 +221,10 @@ GtkWidget *localConnectionToggle; GtkWidget *lcTraceToggle; GtkWidget *solSandbox; + GtkWidget *osText; + GtkWidget *versionText; + GtkWidget *librarySize; + GtkWidget *startStoppedToggle; #ifdef USE_DEBUGGER GtkWidget *DebuggerToggle; #endif Index: libbase/rc.cpp =================================================================== RCS file: /sources/gnash/gnash/libbase/rc.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -b -r1.53 -r1.54 --- libbase/rc.cpp 17 Jan 2008 15:25:36 -0000 1.53 +++ libbase/rc.cpp 18 Jan 2008 12:19:47 -0000 1.54 @@ -1,6 +1,6 @@ // rc.cpp: "Run Command" configuration file, for Gnash. // -// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 208 Free Software Foundation, Inc. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -199,7 +199,7 @@ /// appended ('append <list> <items>'). void -RcInitFile::parseList(std::vector<std::string> &list, string &action, +RcInitFile::parseList(PathList &list, string &action, std::string &listname, string &items) { // GNASH_REPORT_FUNCTION; @@ -328,9 +328,9 @@ } void -RcInitFile::writeList (std::vector<std::string>& list, std::ostream& o) +RcInitFile::writeList (PathList& list, std::ostream& o) { - for (std::vector<std::string>::const_iterator it = list.begin(); + for (PathList::const_iterator it = list.begin(); it != list.end(); ++it) { o << *it << " "; } @@ -506,6 +506,38 @@ return true; } +bool +RcInitFile::updateFile() +{ + + std::string writefile; + + // The file specified in GNASHRC environment variable + // should be written first. + // If you name an important file in GNASHRC and 'save' the + // preferences, you'll obviously overwrite that file. + char *gnashrc = getenv("GNASHRC"); + if (gnashrc) { + writefile = gnashrc; + return updateFile(writefile); + } + + // Check the users home directory + char *home = getenv("HOME"); + if (home) { + writefile = home; + writefile += "/.gnashrc"; + return updateFile(writefile); + } + + // We don't want to try writing to /etc/ et cetera, since + // these are likely to be system-wide defaults set by administrators + // or distros, useful for a model rcfile. They are likely to have + // no write permission anyway unless you are running Gnash with + // administrative privileges, and that is a bad idea. + return false; + +} // Write the changed settings to the config file bool RcInitFile::updateFile(const std::string& filespec) @@ -528,6 +560,7 @@ // Bools and numbers. We want boolean values written as words. out << boolalpha << + _("# Generated by Gnash. Manual changes to this file may be overridden.") << endl << cmd << "splash_screen " << _splashScreen << endl << cmd << "localHost " << _localhostOnly << endl << cmd << "localDomain " << _localdomainOnly << endl << Index: libbase/rc.h =================================================================== RCS file: /sources/gnash/gnash/libbase/rc.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -b -r1.40 -r1.41 --- libbase/rc.h 17 Jan 2008 15:25:36 -0000 1.40 +++ libbase/rc.h 18 Jan 2008 12:19:47 -0000 1.41 @@ -1,5 +1,5 @@ // -// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -42,8 +42,19 @@ bool loadFiles(); bool parseFile(const std::string& filespec); + + /// Writes a valid gnashrc file. If the file already exists, + /// is is overwritten. + /// @param filespec the file to write + /// @return whether the file was successfully written. bool updateFile(const std::string& filespec); + /// Writes a gnashrc file to the file specified in the + /// GNASHRC environment variable OR to the user's home + /// directory. + /// @return whether the file was successfully written. + bool updateFile(); + bool useSplashScreen() const { return _splashScreen; } void useSplashScreen(bool value); @@ -59,14 +70,15 @@ int getTimerDelay() const { return _delay; } void setTimerDelay(int x) { _delay = x; } - int getMovieLibraryLimit() const { return _movieLibraryLimit; } - bool showASCodingErrors() const { return _verboseASCodingErrors; } void showASCodingErrors(bool value); bool showMalformedSWFErrors() const { return _verboseMalformedSWF; } void showMalformedSWFErrors(bool value); + int getMovieLibraryLimit() const { return _movieLibraryLimit; } + void setMovieLibraryLimit(int value) { _movieLibraryLimit = value; } + bool enableExtensions() const { return _extensionsEnabled; } /// Return true if user is willing to start the gui in "stop" mode @@ -74,8 +86,10 @@ /// defaults to false. /// bool startStopped() const { return _startStopped; } + void startStopped(bool value) { _startStopped = value; } bool insecureSSL() const { return _insecureSSL; } + void insecureSSL(bool value) { _insecureSSL = value; } int verbosityLevel() const { return _verbosity; } void verbosityLevel(int value) { _verbosity = value; } @@ -100,29 +114,30 @@ bool useLocalDomain() const { return _localdomainOnly; } void useLocalDomain(bool value); + /// Whether to restrict access to the local host bool useLocalHost() const { return _localhostOnly; } - void useLocalHost(bool value); - - const std::vector<std::string>& getWhiteList() const { return _whitelist; } - const std::vector<std::string>& getBlackList() const { return _blacklist; } - - const std::string& getFlashVersionString() const { return _flashVersionString; } - - const std::string& getFlashSystemOS() const { return _flashSystemOS; } - - const std::string& getFlashSystemManufacturer() const { return _flashSystemManufacturer; } - int getRetries() const { return _retries; } - void setRetries(int x) { _retries = x; } - - /// Return the number of seconds of inactivity before timing out streams downloads - double getStreamsTimeout() const { return _streamsTimeout; } - - /// Set the number of seconds of inactivity before timing out streams downloads - void setStreamsTimeout(double x) { _streamsTimeout = x; } + /// Set whether to restrict access to the local host + void useLocalHost(bool value); typedef std::vector<std::string> PathList; + /// Get the current RcInitFile whitelist of domains to allow + /// @return a std::vector of strings containing allowed domains + const PathList& getWhiteList() const { return _whitelist; } + + /// Sets the RcInitFile whitelist of domains to allow + /// @param list a std::vector of strings containing domains without protocol + void setWhitelist (std::vector<std::string>& list) { _whitelist = list; } + + /// Get the current RcInitFile blacklist of domains to block + /// @return a std::vector of strings containing blocked domains + const PathList& getBlackList() const { return _blacklist; } + + /// Sets the RcInitFile blacklist of domains to block + /// @param list a std::vector of strings containing domains without protocol + void setBlacklist (std::vector<std::string>& list) { _blacklist = list; } + /// Return the list of directories to be used as the 'local' sandbox // /// Local sendbox is the set of resources on the filesystem we want to @@ -136,12 +151,32 @@ _localSandboxPath.push_back(dir); } - /// Set the local sandbox list + /// Sets a list of sandbox paths. Gnash will only allow movies access + /// to files in these paths. The path of the movie playing is automatically + /// added. + /// @param list a std::vector of strings containing paths to allow void setLocalSandboxPath(const PathList& path) { _localSandboxPath = path; } + const std::string& getFlashVersionString() const { return _flashVersionString; } + void setFlashVersionString(std::string& value) { _flashVersionString = value; } + + const std::string& getFlashSystemOS() const { return _flashSystemOS; } + void setFlashSystemOS(std::string& value) { _flashSystemOS = value; } + + const std::string& getFlashSystemManufacturer() const { return _flashSystemManufacturer; } + void setFlashSystemManufacturer(std::string& value) { _flashSystemManufacturer = value; } + + int getRetries() const { return _retries; } + void setRetries(int x) { _retries = x; } + + /// Return the number of seconds of inactivity before timing out streams downloads + double getStreamsTimeout() const { return _streamsTimeout; } + /// Set the number of seconds of inactivity before timing out streams downloads + void setStreamsTimeout(double x) { _streamsTimeout = x; } + /// Get the URL opener command format // /// The %u label will need to be substituted by the actual url @@ -175,10 +210,20 @@ void dump(); private: - uint32_t _delay; // the timer delay - uint32_t _movieLibraryLimit; // max number of movie clips to store in the library - bool _debug; // enable debugging of this class - bool _debugger; // enable the Flash movie debugger + + /// The timer delay + uint32_t _delay; + + /// Max number of movie clips to store in the library + uint32_t _movieLibraryLimit; + + /// Enable debugging of this class + bool _debug; + + /// Enable the Flash movie debugger + bool _debugger; + + // Level of debugging output uint32_t _verbosity; /// Command format to use to open urls @@ -201,10 +246,10 @@ /// in Actionscript std::string _flashSystemManufacturer; - /// enable dumping actionscript classes + /// Enable dumping actionscript classes bool _actionDump; - /// enable dumping parser data + /// Enable dumping parser data bool _parserDump; /// Enable ActionScript errors verbosity @@ -213,29 +258,47 @@ /// Enable Malformed SWF verbosity bool _verboseMalformedSWF; + /// Display a splash screen when loading a movie + bool _splashScreen; + + /// Only access network resources in the local domain + bool _localdomainOnly; + + /// Only access network resources on the local host + bool _localhostOnly; + + /// Allowed domains + PathList _whitelist; + + /// Blocked Domains + PathList _blacklist; + + /// The name of the debug log + std::string _log; + + /// Enable writing the debug log to disk + bool _writeLog; - /// End user Features - bool _splashScreen; // display a splash screen when - // loading a movie - /// Security Features - bool _localdomainOnly; // only access network resources for - // the local domain - bool _localhostOnly; // only access network resources - std::vector<std::string> _whitelist; // domains we allow - std::vector<std::string> _blacklist; // domains we don't allow - std::string _log; // the name of the debug log - bool _writeLog; // enable writing the debug log to disk - std::string _wwwroot; // the root path for the streaming server - int _retries; // the number of retries for a thread - bool _sound; // whether sound is enable or not - bool _pluginSound; // whether sound is desired for the plugin + /// The root path for the streaming server + std::string _wwwroot; - bool _extensionsEnabled; // whether to scan plugin path for extensions + /// the number of retries for a thread + int _retries; - bool _startStopped; // whether to start the gui in "stop" mode + /// Enable the sound handler at startup + bool _sound; - bool _insecureSSL; // When TRUE, does not verify SSL certificates - // so is INSECURE. + /// Enable sound for the plugin + bool _pluginSound; + + /// Enable scanning plugin path for extensions + bool _extensionsEnabled; + + /// Start the gui in "stop" mode + bool _startStopped; + + /// Allow SSL connections without verifying the certificate + bool _insecureSSL; /// The number of seconds of inactivity triggering download timeout double _streamsTimeout; @@ -248,14 +311,22 @@ // or read from. std::string _solsandbox; + /// Whether SOL files can be written bool _solreadonly; bool _sollocaldomain; + + // Disable local connection bool _lcdisabled; + + /// Trace local connection activity (in log) bool _lctrace; + + /// Shared memory segment key (can be set for + /// compatibility with other players. key_t _lcshmkey; - // A function only for writing lists to an outstream. - void writeList(std::vector<std::string>& list, std::ostream& o); + // A function only for writing path lists to an outstream. + void writeList(PathList& list, std::ostream& o); protected: @@ -265,7 +336,8 @@ /// Never destroy (TODO: add a destroyDefaultInstance) ~RcInitFile(); - void expandPath(std::string& path); //path string operations + /// Performs substitution on a path string (~) + void expandPath(std::string& path); static bool extractSetting(bool *var, const char *pattern, std::string &variable, std::string &value); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit