gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog libbase/rc.h gui/gtk.cpp gui/gt...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog libbase/rc.h gui/gtk.cpp gui/gt...
Date: Tue, 22 Jan 2008 14:53:20 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/01/22 14:53:20

Modified files:
        .              : ChangeLog 
        libbase        : rc.h 
        gui            : gtk.cpp gtksup.h 

Log message:
                * libbase/rc.h: Add method to set url opener format.
                * gui/gtk{sup.h,.cpp}: option to set url opener format, tidy up,
                  don't leak prefsData struct when the dialogue is closed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5466&r2=1.5467
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.136&r2=1.137
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtksup.h?cvsroot=gnash&r1=1.62&r2=1.63

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5466
retrieving revision 1.5467
diff -u -b -r1.5466 -r1.5467
--- ChangeLog   22 Jan 2008 14:37:10 -0000      1.5466
+++ ChangeLog   22 Jan 2008 14:53:19 -0000      1.5467
@@ -1,3 +1,9 @@
+2008-01-22 Benjamin Wolsey <address@hidden>
+
+       * libbase/rc.h: Add method to set url opener format.
+       * gui/gtk{sup.h,.cpp}: option to set url opener format, tidy up,
+         don't leak prefsData struct when the dialogue is closed.
+
 2008-01-22 Sandro Santilli <address@hidden>
 
        * server/asobj/NetStream.{h,cpp}: add an isConnected

Index: libbase/rc.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/rc.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- libbase/rc.h        21 Jan 2008 20:55:45 -0000      1.42
+++ libbase/rc.h        22 Jan 2008 14:53:19 -0000      1.43
@@ -180,13 +180,18 @@
     /// Get the URL opener command format
     //
     /// The %u label will need to be substituted by the actual url
-    /// properly excaped.
+    /// properly escaped.
     ///
     const std::string &getURLOpenerFormat() const
     {
         return _urlOpenerFormat;
     }
 
+    void setURLOpenerFormat(const std::string& value)
+    {
+        _urlOpenerFormat = value;
+    }
+
     // Get the location of the sandbox for .sol files
     const std::string &getSOLSafeDir() const { return _solsandbox; }
 

Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -b -r1.136 -r1.137
--- gui/gtk.cpp 22 Jan 2008 03:26:16 -0000      1.136
+++ gui/gtk.cpp 22 Jan 2008 14:53:19 -0000      1.137
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: gtk.cpp,v 1.136 2008/01/22 03:26:16 rsavoye Exp $ */
+/* $Id: gtk.cpp,v 1.137 2008/01/22 14:53:19 bwy Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -58,8 +58,6 @@
 # include <hildon/hildon.h>
 #endif
 
-using namespace std;
-
 namespace gnash 
 {
 
@@ -743,7 +741,7 @@
 
 /// This method is called when the "OK" button is clicked in the open file
 /// dialog. For GTK <= 2.4.0, this is a callback called by GTK itself.
-void GtkGui::open_file (GtkWidget *widget, gpointer /* user_data */)
+void GtkGui::openFile (GtkWidget *widget, gpointer /* user_data */)
 {
 #if 0
     // We'll need this when implementing file opening.
@@ -777,13 +775,14 @@
 // Callback to read values from the preferences dialogue and set rcfile
 // values accordingly.
 void
-GtkGui::updateRC (GtkWidget* dialog, gint response, gpointer data)
+GtkGui::handlePrefs (GtkWidget* dialog, gint response, gpointer data)
 {
 
+    prefData *prefs = static_cast<prefData*>(data);
+
     if (response == GTK_RESPONSE_APPLY) {
 
         // 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&
         std::string tmp;
@@ -843,6 +842,9 @@
         rcfile.startStopped(
                
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prefs->startStoppedToggle)));
        
+        tmp = gtk_entry_get_text(GTK_ENTRY(prefs->urlOpenerText));             
+        rcfile.setURLOpenerFormat(tmp);
+       
        // 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.
@@ -855,8 +857,12 @@
     else if (response == GTK_RESPONSE_CLOSE) {
         // Close the window only when 'close' is clicked
         gtk_widget_destroy(dialog);
+        if (prefs) delete prefs;
     }
 
+    else if (response == GTK_RESPONSE_DELETE_EVENT) {
+        if (prefs) delete prefs;
+    }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -871,7 +877,7 @@
 GtkGui::showPreferencesDialog()
 {
     
-    prefData *prefs(new prefData);
+    prefData *prefs = new prefData;
 
     RcInitFile& rcfile = RcInitFile::getDefaultInstance();
 
@@ -896,8 +902,8 @@
                GTK_CONTAINER(GTK_DIALOG(prefsDialog)->vbox), notebook1);
 
     // Pass the widgets containing settings to the callback function
-    // when any button is clicked.
-    g_signal_connect (prefsDialog, "response", G_CALLBACK(&updateRC), prefs);
+    // when any button is clicked or when the dialogue is destroyed.
+    g_signal_connect (prefsDialog, "response", G_CALLBACK(&handlePrefs), 
prefs);
 
     // Logging Tab
     GtkWidget *loggingvbox = gtk_vbox_new (FALSE, 10);
@@ -1105,6 +1111,19 @@
     gtk_misc_set_alignment (GTK_MISC (OSadvicelabel), 0, 0.5);
     gtk_box_pack_start(GTK_BOX(playervbox), OSadvicelabel, FALSE, FALSE, 0);   
  
 
+    // URL opener
+    GtkWidget *urlopenerbox = gtk_hbox_new (FALSE, 2);
+    gtk_box_pack_start(GTK_BOX(playervbox), urlopenerbox, FALSE, FALSE, 0);
+    
+    GtkWidget *urlopenerlabel = gtk_label_new (_("URL opener:"));
+    gtk_misc_set_alignment (GTK_MISC (urlopenerlabel), 0, 0.5);
+    gtk_box_pack_start(GTK_BOX(urlopenerbox), urlopenerlabel, FALSE, FALSE, 0);
+    
+    prefs->urlOpenerText = gtk_entry_new ();
+    gtk_box_pack_start(GTK_BOX(urlopenerbox), prefs->urlOpenerText, FALSE, 
FALSE, 0);
+    // Put text in the entry box      
+    gtk_entry_set_text(GTK_ENTRY(prefs->urlOpenerText), 
rcfile.getURLOpenerFormat().c_str());
+
     // Performance
     GtkWidget *performancelabel = gtk_label_new (_("<b>Performance</b>"));
     gtk_label_set_use_markup (GTK_LABEL (performancelabel), TRUE);
@@ -1311,7 +1330,7 @@
         NULL 
     };
 
-    string comments = _("Gnash is the GNU Flash movie player based on 
GameSWF.");
+    std::string comments = _("Gnash is the GNU Flash movie player based on 
GameSWF.");
 
     comments += _("\nRenderer: ");
     comments += RENDERER_CONFIG;
@@ -1356,7 +1375,7 @@
                                           NULL);
     
     if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
-        open_file(dialog, gui);
+        openFile(dialog, gui);
     }
     
     gtk_widget_destroy (dialog);
@@ -1365,7 +1384,7 @@
 
     GtkFileSelection* selector = GTK_FILE_SELECTION(dialog);
 
-    g_signal_connect (selector->ok_button, "clicked", G_CALLBACK (open_file),
+    g_signal_connect (selector->ok_button, "clicked", G_CALLBACK (openFile),
                       gui);
 
     g_signal_connect_swapped (selector->ok_button, "clicked", 

Index: gui/gtksup.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gtksup.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- gui/gtksup.h        21 Jan 2008 20:55:42 -0000      1.62
+++ gui/gtksup.h        22 Jan 2008 14:53:20 -0000      1.63
@@ -203,7 +203,7 @@
     static gnash::key::code gdk_to_gnash_key(guint key);
     static int gdk_to_gnash_modifier(int state);
 
-    // A struct containing widgets for passing preference 
+    // A struct containing pointers to widgets for passing preference 
     // data from the dialogue   
     struct prefData {
         GtkWidget *soundToggle;
@@ -223,6 +223,7 @@
         GtkWidget *solSandbox;
         GtkWidget *osText;
         GtkWidget *versionText;
+        GtkWidget *urlOpenerText;
         GtkWidget *librarySize;
         GtkWidget *startStoppedToggle;
 #ifdef USE_DEBUGGER
@@ -230,8 +231,8 @@
 #endif
     };
     
-    static void updateRC(GtkWidget* widget, gint response, gpointer data);
-    static void open_file(GtkWidget* dialog, gpointer data);
+    static void handlePrefs(GtkWidget* widget, gint response, gpointer data);
+    static void openFile(GtkWidget* dialog, gpointer data);
 
 };
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]