[totem] Include movie title in suggested name of gallery
- From: Robin Stocker <robinst src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem] Include movie title in suggested name of gallery
- Date: Tue, 24 Nov 2009 11:14:24 +0000 (UTC)
commit a4b3ab79a9a1b7eee767797a27daa9f992c6928a
Author: Robin Stocker <robin nibor org>
Date: Sat Nov 21 19:25:08 2009 +0100
Include movie title in suggested name of gallery
Also make it use "Gallery" instead of "Screenshot".
https://bugzilla.gnome.org/show_bug.cgi?id=595760
src/plugins/screenshot/totem-gallery.c | 13 ++++++++++---
src/plugins/screenshot/totem-screenshot-plugin.c | 12 ++++++------
src/plugins/screenshot/totem-screenshot-plugin.h | 2 +-
src/plugins/screenshot/totem-screenshot.c | 9 ++++++---
src/plugins/screenshot/totem-screenshot.h | 2 +-
5 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/screenshot/totem-gallery.c b/src/plugins/screenshot/totem-gallery.c
index 5e353a6..a9aa0a6 100644
--- a/src/plugins/screenshot/totem-gallery.c
+++ b/src/plugins/screenshot/totem-gallery.c
@@ -68,7 +68,7 @@ totem_gallery_new (Totem *totem, TotemPlugin *plugin)
TotemGallery *gallery;
GtkWidget *container;
GtkBuilder *builder;
- gchar *uri, *suggested_name;
+ gchar *movie_title, *uri, *suggested_name;
GFile *file;
/* Create the gallery and its interface */
@@ -105,8 +105,15 @@ totem_gallery_new (Totem *totem, TotemPlugin *plugin)
"gallery_dialog_content"));
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (gallery), container);
- /* Translators: the argument is a screenshot number, used to prevent overwriting files. Just translate "Screenshot", and not the ".jpg". */
- uri = totem_screenshot_plugin_setup_file_chooser (N_("Screenshot%d.jpg"));
+ movie_title = totem_get_short_title (totem);
+
+ /* Translators: The first argument is the movie title. The second
+ * argument is a number which is used to prevent overwriting files.
+ * Just translate "Gallery", and not the ".jpg". Example:
+ * "Galerie-%s-%d.jpg". */
+ uri = totem_screenshot_plugin_setup_file_chooser (N_("Gallery-%s-%d.jpg"), movie_title);
+ g_free (movie_title);
+
file = g_file_new_for_uri (uri);
/* We can use g_file_get_basename here and be sure that it's UTF-8
* because we provided the name. */
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.c b/src/plugins/screenshot/totem-screenshot-plugin.c
index 080d6f2..a48f67e 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.c
+++ b/src/plugins/screenshot/totem-screenshot-plugin.c
@@ -106,7 +106,7 @@ take_screenshot_action_cb (GtkAction *action, TotemScreenshotPlugin *self)
return;
}
- dialog = totem_screenshot_new (TOTEM_PLUGIN (self), pixbuf);
+ dialog = totem_screenshot_new (priv->totem, TOTEM_PLUGIN (self), pixbuf);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -294,12 +294,12 @@ impl_deactivate (TotemPlugin *plugin, TotemObject *totem)
}
static char *
-make_filename_for_dir (const char *directory, const char *format)
+make_filename_for_dir (const char *directory, const char *format, const char *movie_title)
{
char *fullpath, *filename;
guint i = 1;
- filename = g_strdup_printf (_(format), i);
+ filename = g_strdup_printf (_(format), movie_title, i);
fullpath = g_build_filename (directory, filename, NULL);
while (g_file_test (fullpath, G_FILE_TEST_EXISTS) != FALSE && i < G_MAXINT) {
@@ -307,7 +307,7 @@ make_filename_for_dir (const char *directory, const char *format)
g_free (filename);
g_free (fullpath);
- filename = g_strdup_printf (_(format), i);
+ filename = g_strdup_printf (_(format), movie_title, i);
fullpath = g_build_filename (directory, filename, NULL);
}
@@ -317,7 +317,7 @@ make_filename_for_dir (const char *directory, const char *format)
}
gchar *
-totem_screenshot_plugin_setup_file_chooser (const char *filename_format)
+totem_screenshot_plugin_setup_file_chooser (const char *filename_format, const char *movie_title)
{
GConfClient *client;
char *path, *filename, *full, *uri;
@@ -337,7 +337,7 @@ totem_screenshot_plugin_setup_file_chooser (const char *filename_format)
path = g_strdup (g_get_home_dir ());
}
- filename = make_filename_for_dir (path, filename_format);
+ filename = make_filename_for_dir (path, filename_format, movie_title);
/* Build the URI */
full = g_build_filename (path, filename, NULL);
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.h b/src/plugins/screenshot/totem-screenshot-plugin.h
index b8baa80..e3c2ce9 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.h
+++ b/src/plugins/screenshot/totem-screenshot-plugin.h
@@ -56,7 +56,7 @@ typedef struct {
GType totem_screenshot_plugin_get_type (void) G_GNUC_CONST;
G_MODULE_EXPORT GType register_totem_plugin (GTypeModule *module);
-gchar *totem_screenshot_plugin_setup_file_chooser (const char *filename_format) G_GNUC_WARN_UNUSED_RESULT;
+gchar *totem_screenshot_plugin_setup_file_chooser (const char *filename_format, const char *movie_name) G_GNUC_WARN_UNUSED_RESULT;
void totem_screenshot_plugin_update_file_chooser (const char *filename);
G_END_DECLS
diff --git a/src/plugins/screenshot/totem-screenshot.c b/src/plugins/screenshot/totem-screenshot.c
index ff7d0df..f10dacc 100644
--- a/src/plugins/screenshot/totem-screenshot.c
+++ b/src/plugins/screenshot/totem-screenshot.c
@@ -145,16 +145,19 @@ totem_screenshot_init (TotemScreenshot *screenshot)
}
GtkWidget *
-totem_screenshot_new (TotemPlugin *screenshot_plugin, GdkPixbuf *screen_image)
+totem_screenshot_new (Totem *totem, TotemPlugin *screenshot_plugin, GdkPixbuf *screen_image)
{
TotemScreenshot *screenshot;
GtkContainer *content_area;
- char *interface_path, *initial_uri;
+ gchar *movie_title, *interface_path, *initial_uri;
screenshot = TOTEM_SCREENSHOT (g_object_new (TOTEM_TYPE_SCREENSHOT, NULL));
+ movie_title = totem_get_short_title (totem);
+
/* Create the screenshot widget */
- initial_uri = totem_screenshot_plugin_setup_file_chooser (N_("Screenshot%d.png"));
+ initial_uri = totem_screenshot_plugin_setup_file_chooser (N_("Screenshot-%s-%d.png"), movie_title);
+ g_free (movie_title);
interface_path = totem_plugin_find_file (screenshot_plugin, "gnome-screenshot.ui");
screenshot->priv->widget = GNOME_SCREENSHOT_WIDGET (gnome_screenshot_widget_new (interface_path, screen_image, initial_uri));
g_free (interface_path);
diff --git a/src/plugins/screenshot/totem-screenshot.h b/src/plugins/screenshot/totem-screenshot.h
index ebfd077..36cf383 100644
--- a/src/plugins/screenshot/totem-screenshot.h
+++ b/src/plugins/screenshot/totem-screenshot.h
@@ -54,7 +54,7 @@ struct TotemScreenshotClass {
};
GType totem_screenshot_get_type (void) G_GNUC_CONST;
-GtkWidget *totem_screenshot_new (TotemPlugin *screenshot_plugin, GdkPixbuf *screen_image) G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *totem_screenshot_new (Totem *totem, TotemPlugin *screenshot_plugin, GdkPixbuf *screen_image) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]