[Swfdec] 2 commits - doc/swfdec-sections.txt
libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h
player/swfdebug.c
Benjamin Otte
company at kemper.freedesktop.org
Wed Feb 7 15:10:41 PST 2007
doc/swfdec-sections.txt | 1 +
libswfdec/swfdec_loader.c | 33 +++++++++++++++++++++++++++++++++
libswfdec/swfdec_loader.h | 9 +++++----
player/swfdebug.c | 2 +-
4 files changed, 40 insertions(+), 5 deletions(-)
New commits:
diff-tree 998ea3e494c4d6f2d798085b3df1e4da07b18a68 (from 06c1025c1946a32b4f2a8f8ebab29736ec231621)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Feb 8 00:11:45 2007 +0100
use a save icon when saving
diff --git a/player/swfdebug.c b/player/swfdebug.c
index 490814e..63af21d 100644
--- a/player/swfdebug.c
+++ b/player/swfdebug.c
@@ -16,7 +16,7 @@ save_to_svg (GtkWidget *button, SwfdecPl
GtkWidget *dialog = gtk_file_chooser_dialog_new ("Save current frame as",
GTK_WINDOW (gtk_widget_get_toplevel (button)), GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
int w, h;
diff-tree 06c1025c1946a32b4f2a8f8ebab29736ec231621 (from 17f85210c89d16ae4824771d41ea5bf41988b123)
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Feb 8 00:11:26 2007 +0100
add swfdec_loader_get_filename()
This function is supposed to give a useful filename for the loader, so it
can be used to save it locally.
diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index 937b8db..3a93f97 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -20,6 +20,7 @@ SwfdecLoader
swfdec_loader_new_from_file
swfdec_loader_push
swfdec_loader_eof
+swfdec_loader_get_filename
<SUBSECTION Standard>
SWFDEC_LOADER
SWFDEC_IS_LOADER
diff --git a/libswfdec/swfdec_loader.c b/libswfdec/swfdec_loader.c
index a5300b8..557fa1c 100644
--- a/libswfdec/swfdec_loader.c
+++ b/libswfdec/swfdec_loader.c
@@ -21,6 +21,7 @@
#include "config.h"
#endif
+#include <string.h>
#include "swfdec_loader_internal.h"
#include "swfdec_buffer.h"
#include "swfdec_debug.h"
@@ -351,3 +352,35 @@ swfdec_loader_eof (SwfdecLoader *loader)
swfdec_loader_parse (loader);
}
+/**
+ * swfdec_loader_get_filename:
+ * @loader: a #SwfdecLoader
+ *
+ * Gets the suggested filename to use for this loader. This may be of interest
+ * when displaying information about the file that is played back.
+ *
+ * Returns: A string in the glib filename encoding that contains the filename
+ * for this loader. g_free() after use.
+ **/
+char *
+swfdec_loader_get_filename (SwfdecLoader *loader)
+{
+ char *start, *ret;
+
+ g_return_val_if_fail (SWFDEC_IS_LOADER (loader), NULL);
+ /* every loader must set this */
+ g_return_val_if_fail (loader->url != NULL, NULL);
+
+ start = strrchr (loader->url, '/');
+ if (start == NULL) {
+ start = loader->url;
+ } else {
+ start++;
+ }
+ ret = g_filename_from_utf8 (start, -1, NULL, NULL, NULL);
+ if (ret == NULL)
+ ret = g_strdup ("unknown.swf");
+
+ return ret;
+}
+
diff --git a/libswfdec/swfdec_loader.h b/libswfdec/swfdec_loader.h
index c9b1e2e..cf1d65a 100644
--- a/libswfdec/swfdec_loader.h
+++ b/libswfdec/swfdec_loader.h
@@ -40,7 +40,7 @@ struct _SwfdecLoader
{
GObject object;
- char * url; /* the URL for this loader */
+ char * url; /* the URL for this loader in UTF-8 - must be set on creation */
/*< private >*/
gboolean eof; /* if we're in EOF already */
gboolean error; /* if there's an error (from parsing the loader) */
@@ -65,9 +65,10 @@ GType swfdec_loader_get_type (void);
SwfdecLoader * swfdec_loader_new_from_file (const char * filename,
GError ** error);
-void swfdec_loader_push (SwfdecLoader * loader,
- SwfdecBuffer * buffer);
-void swfdec_loader_eof (SwfdecLoader * loader);
+void swfdec_loader_push (SwfdecLoader * loader,
+ SwfdecBuffer * buffer);
+void swfdec_loader_eof (SwfdecLoader * loader);
+char * swfdec_loader_get_filename (SwfdecLoader * loader);
G_END_DECLS
More information about the Swfdec
mailing list