[Swfdec] 8 commits - player/swfdec-player.c player/swfdec-player.ui player/swfdec-window.c player/swfdec-window-handlers.c

Benjamin Otte company at kemper.freedesktop.org
Mon Jan 14 04:03:23 PST 2008


 player/swfdec-player.c          |    8 ++++----
 player/swfdec-player.ui         |    9 ++++++++-
 player/swfdec-window-handlers.c |   19 ++++++++++++++++++-
 player/swfdec-window.c          |   35 +++++++++++++++++++++++++++++++++--
 4 files changed, 63 insertions(+), 8 deletions(-)

New commits:
commit d7840716923b5367caf9fef02511161ce1c105dd
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 12:53:42 2008 +0100

    make sure the recent files only include files from swfdec-player

diff --git a/player/swfdec-window.c b/player/swfdec-window.c
index c7fa72c..5b1a32e 100644
--- a/player/swfdec-window.c
+++ b/player/swfdec-window.c
@@ -78,11 +78,17 @@ swfdec_window_init (SwfdecWindow *window)
 static void
 swfdec_window_player_initialized (SwfdecPlayer *player, GParamSpec *pspec, SwfdecWindow *window)
 {
-  if (!swfdec_player_is_initialized (player))
-    return;
-
-  gtk_recent_manager_add_item (gtk_recent_manager_get_default (),
-      swfdec_url_get_url (swfdec_loader_get_url (window->loader)));
+  static const char *mime[2] = { "swfdec-player", NULL };
+  GtkRecentData data = { NULL, NULL, (char *) "application/x-shockwave-flash",
+    (char *) g_get_application_name (), g_strjoin (" ", g_get_prgname (), "%u", NULL), 
+    (char **) mime, FALSE };
+
+  if (swfdec_player_is_initialized (player)) {
+    gtk_recent_manager_add_full (gtk_recent_manager_get_default (),
+	swfdec_url_get_url (swfdec_loader_get_url (window->loader)),
+	&data);
+  }
+  g_free (data.app_exec);
 }
 
 /**
@@ -148,6 +154,16 @@ swfdec_window_error (SwfdecWindow *window, const char *msg)
   window->error = TRUE;
 }
 
+static void
+swfdec_window_add_recent_filter (GtkRecentChooser *chooser)
+{
+  GtkRecentFilter *filter;
+
+  filter = gtk_recent_filter_new ();
+  gtk_recent_filter_add_group (filter, "swfdec-player");
+  gtk_recent_chooser_set_filter (chooser, filter);
+}
+
 #define BUILDER_FILE DATADIR G_DIR_SEPARATOR_S "swfdec-gnome" G_DIR_SEPARATOR_S "swfdec-player.ui"
 /**
  * swfdec_window_new:
@@ -172,6 +188,8 @@ swfdec_window_new (const char *url)
     return window;
   }
   gtk_builder_connect_signals (window->builder, window);
+  swfdec_window_add_recent_filter (GTK_RECENT_CHOOSER (
+	gtk_builder_get_object (window->builder, "recent")));
   window->window = GTK_WIDGET (gtk_builder_get_object (window->builder, "player-window"));
   if (window->window == NULL) {
     swfdec_window_error (window, _("Broken user interface definition file"));
commit 3303418faa1ae48a5401b799a2a4ef44c6620b77
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 12:53:17 2008 +0100

    remove the old placeholder

diff --git a/player/swfdec-player.ui b/player/swfdec-player.ui
index f28ca07..caed4ec 100644
--- a/player/swfdec-player.ui
+++ b/player/swfdec-player.ui
@@ -78,7 +78,6 @@
             <menuitem name="play" action="play"/>
             <menuitem name="mute" action="mute"/>
             <separator/>
-            <placeholder name="recent-placeholder"/>
             <menuitem name="quit" action="quit"/>
          </menu>
          <menu name="help" action="help-menu">
commit 64bb6ad07d42ddf251c8e76dfb48b92c91a032a6
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 12:06:20 2008 +0100

    add a simple recent files menu entry

diff --git a/player/swfdec-player.ui b/player/swfdec-player.ui
index fbba9e9..f28ca07 100644
--- a/player/swfdec-player.ui
+++ b/player/swfdec-player.ui
@@ -21,6 +21,13 @@
             <accelerator key="O" modifiers="GDK_CONTROL_MASK"/>
          </child>
          <child>
+            <object class="GtkRecentAction" id="recent">
+               <property name="label" translatable="yes">Open _Recent</property>
+               <property name="tooltip" translatable="yes">Select a recently opened file</property>
+               <signal name="item-activated" handler="menu_file_recent"/>
+            </object>
+         </child>
+         <child>
             <object class="GtkToggleAction" id="play">
                <property name="label" translatable="yes">Play / P_ause</property>
                <property name="stock-id">gtk-media-play</property>
@@ -66,11 +73,12 @@
       <menubar name="player-menubar">
          <menu name="file" action="file-menu">
             <menuitem name="open" action="open"/>
-            <placeholder name="recent-placeholder"/>
+            <menuitem name="recent" action="recent"/>
             <separator/>
             <menuitem name="play" action="play"/>
             <menuitem name="mute" action="mute"/>
             <separator/>
+            <placeholder name="recent-placeholder"/>
             <menuitem name="quit" action="quit"/>
          </menu>
          <menu name="help" action="help-menu">
diff --git a/player/swfdec-window-handlers.c b/player/swfdec-window-handlers.c
index b169778..3171429 100644
--- a/player/swfdec-window-handlers.c
+++ b/player/swfdec-window-handlers.c
@@ -94,6 +94,15 @@ menu_file_close (GtkAction *action, SwfdecWindow *window)
 }
 
 void
+menu_file_recent (GtkAction *action, SwfdecWindow *window)
+{
+  const char *url = gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (action));
+
+  if (!swfdec_window_set_url (window, url))
+    swfdec_window_new (url);
+}
+
+void
 menu_help_about (GtkAction *action, SwfdecWindow *window)
 {
   static const char *authors[] = {
commit 02510bc26d732606029799c1c2b3d82286017807
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 12:04:50 2008 +0100

    set settings automatically after creating the window

diff --git a/player/swfdec-window-handlers.c b/player/swfdec-window-handlers.c
index a876207..b169778 100644
--- a/player/swfdec-window-handlers.c
+++ b/player/swfdec-window-handlers.c
@@ -35,7 +35,6 @@ menu_file_open_response (GtkFileChooser *chooser, gint response, SwfdecWindow *w
 
       if (!swfdec_window_set_url (window, url)) {
 	SwfdecWindow *new = swfdec_window_new (url);
-	swfdec_window_set_settings (new, &window->settings);
       }
       g_free (url);
       g_free (target);
diff --git a/player/swfdec-window.c b/player/swfdec-window.c
index cb0fe0a..c7fa72c 100644
--- a/player/swfdec-window.c
+++ b/player/swfdec-window.c
@@ -181,6 +181,7 @@ swfdec_window_new (const char *url)
   if (url != NULL) {
     swfdec_window_set_url (window, url);
   }
+  swfdec_window_set_settings (window, &window->settings);
 
   return window;
 }
commit 6ef67f1f080a3e23559fbc1eadf16f8a93ddeeea
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 12:03:33 2008 +0100

    add file to recent files when it starts playing

diff --git a/player/swfdec-window.c b/player/swfdec-window.c
index 745d428..cb0fe0a 100644
--- a/player/swfdec-window.c
+++ b/player/swfdec-window.c
@@ -75,12 +75,22 @@ swfdec_window_init (SwfdecWindow *window)
   windows = g_slist_prepend (windows, window);
 }
 
+static void
+swfdec_window_player_initialized (SwfdecPlayer *player, GParamSpec *pspec, SwfdecWindow *window)
+{
+  if (!swfdec_player_is_initialized (player))
+    return;
+
+  gtk_recent_manager_add_item (gtk_recent_manager_get_default (),
+      swfdec_url_get_url (swfdec_loader_get_url (window->loader)));
+}
+
 /**
  * swfdec_window_set_url:
  * @window: the window that should show the given URL
  * @url: URL to show. Must be a valid file:// or http:// URL in UTF-8.
  *
- * Sets the URL of @window to be  @url, if no URL was set on @indow before.
+ * Sets the URL of @window to be  @url, if no URL was set on @window before.
  *
  * Returns: %TRUE if the URL could be set, %FALSE if the window already shows a 
  *          movie.
@@ -100,6 +110,8 @@ swfdec_window_set_url (SwfdecWindow *window, const char *url)
 
   window->loader = swfdec_gtk_loader_new (url);
   window->player = swfdec_gtk_player_new (NULL);
+  g_signal_connect (window->player, "notify::initialized", 
+      G_CALLBACK (swfdec_window_player_initialized), window);
   swfdec_player_set_loader (window->player, window->loader);
   swfdec_gtk_player_set_audio_enabled (SWFDEC_GTK_PLAYER (window->player), 
       window->settings.sound);
commit 783bd8a84af1aeba7cf7b753712f063aaec2b98f
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 10:27:45 2008 +0100

    improve message

diff --git a/player/swfdec-window.c b/player/swfdec-window.c
index 5e7538e..745d428 100644
--- a/player/swfdec-window.c
+++ b/player/swfdec-window.c
@@ -162,7 +162,7 @@ swfdec_window_new (const char *url)
   gtk_builder_connect_signals (window->builder, window);
   window->window = GTK_WIDGET (gtk_builder_get_object (window->builder, "player-window"));
   if (window->window == NULL) {
-    swfdec_window_error (window, _("Internal error in the user interface definition"));
+    swfdec_window_error (window, _("Broken user interface definition file"));
     return window;
   }
   g_object_weak_ref (G_OBJECT (window->window), (GWeakNotify) g_object_unref, window);
commit a2918916ffaa692614524833bdf25d0a93d0229f
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 10:26:04 2008 +0100

    add translators to about box

diff --git a/player/swfdec-window-handlers.c b/player/swfdec-window-handlers.c
index 2b0e4d6..a876207 100644
--- a/player/swfdec-window-handlers.c
+++ b/player/swfdec-window-handlers.c
@@ -112,6 +112,15 @@ menu_help_about (GtkAction *action, SwfdecWindow *window)
       "authors", authors,
       "artists", artists,
       "comments", "Play Adobe Flash files",
+      /* Translators: This is a special message that shouldn't be translated
+       * literally. It is used in the about box to give credits to
+       * the translators.
+       * Thus, you should translate it to your name and email address.
+       * You should also include other translators who have contributed to
+       * this translation; in that case, please write each of them on a separate
+       * line seperated by newlines (\n).
+       */
+      "translator-credits", _("translator-credits"),
       "version", VERSION,
       "website", "http://swfdec.freedesktop.org/",
       NULL);
commit 2861ab3e86e230fbb3312ddb2cf5c2c8e0a3a896
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Jan 14 10:19:52 2008 +0100

    mark all messages for translation

diff --git a/player/swfdec-player.c b/player/swfdec-player.c
index 0e3036b..bd64498 100644
--- a/player/swfdec-player.c
+++ b/player/swfdec-player.c
@@ -55,21 +55,21 @@ main (int argc, char *argv[])
   GOptionEntry options[] = {
     { "no-sound", 'n', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &settings.sound, N_("don't play sound"), NULL },
     { "paused", 'p', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &settings.playing, N_("start player paused"), NULL },
-    { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &filenames, NULL, "<FILE> [<FILE> ...]" },
+    { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &filenames, NULL, N_("[FILE ...]") },
     { NULL }
   };
   GOptionContext *ctx;
 
   g_set_application_name (_("Swfdec Flash Player"));
-  ctx = g_option_context_new ("");
+  ctx = g_option_context_new (NULL);
   g_option_context_set_translation_domain (ctx, GETTEXT_PACKAGE);
-  g_option_context_add_main_entries (ctx, options, "options");
+  g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
   g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
   g_option_context_parse (ctx, &argc, &argv, &error);
   g_option_context_free (ctx);
 
   if (error) {
-    g_printerr ("Error parsing command line arguments: %s\n", error->message);
+    g_printerr (_("Error parsing command line arguments: %s\n"), error->message);
     g_error_free (error);
     return EXIT_FAILURE;
   }


More information about the Swfdec mailing list