diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-02-27 06:01:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-02-27 06:01:48 +0800 |
commit | fbf4b15ed54be3abfe2c3c937c50b9c623804cb5 (patch) | |
tree | 27639ff5895028fd04bcc8c4ce800354b040fa73 /embed/mozilla/ContentHandler.cpp | |
parent | caba7f03132e463c48405eb602a8b77764c3ec75 (diff) | |
download | gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar.gz gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar.bz2 gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar.lz gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar.xz gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.tar.zst gsoc2013-epiphany-fbf4b15ed54be3abfe2c3c937c50b9c623804cb5.zip |
Depend on gnome-desktop for gnome-desktop-item, and up the gnome-vfs
2005-02-26 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
Depend on gnome-desktop for gnome-desktop-item,
and up the gnome-vfs dependency version.
* embed/ephy-embed-persist.c: (ephy_embed_persist_set_user_time),
(ephy_embed_persist_get_user_time),
(ephy_embed_persist_set_property),
(ephy_embed_persist_get_property), (ephy_embed_persist_init),
(ephy_embed_persist_class_init):
* embed/ephy-embed-persist.h:
Add user time property.
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/ContentHandler.h:
Forward user time to MozDownload via a string. Not perfect,
but better than nothing.
* embed/mozilla/EphyHeaderSniffer.cpp:
Set user time on filechooser.
* embed/mozilla/MozDownload.cpp:
Get user time from content handler, and use it when
launching the external handler app.
* lib/ephy-file-helpers.c: (ephy_file_check_mime),
(launch_desktop_item), (ephy_file_launch_desktop_file),
(ephy_file_launch_application), (ephy_file_launch_handler):
* lib/ephy-file-helpers.h:
Convenience functions to launch an app, or a desktop item,
with user time.
* lib/ephy-gui.c: (ephy_gui_confirm_overwrite_file),
(ephy_gui_window_update_user_time), (ephy_gui_window_present):
* lib/ephy-gui.h:
Make our own gtk_window_present, to correctly update user time.
Check if the path is writable in ephy_gui_confirm_overwrite_file().
* src/ephy-session.c: (ephy_session_autoresume):
After showing the recovery dialogue, don't use the old user time
to launch the windows; use the current event time instead.
* src/popup-commands.c: (background_download_completed),
(image_open_uri), (save_source_completed_cb),
(popup_cmd_open_image):
* src/window-commands.c: (window_cmd_file_save_as),
(save_source_completed_cb), (save_temp_source),
(window_cmd_view_page_source):
Launch handlers with user time.
Diffstat (limited to 'embed/mozilla/ContentHandler.cpp')
-rw-r--r-- | embed/mozilla/ContentHandler.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index 91c9d081d..ef2e07b6b 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -25,11 +25,14 @@ #include "config.h" +#include "ContentHandler.h" + #include <gtk/gtkdialog.h> #include <gtk/gtkmessagedialog.h> #include <gtk/gtkstock.h> #include <gtk/gtkimage.h> #include <gtk/gtkbutton.h> +#include <gtk/gtkmain.h> #include <libgnomevfs/gnome-vfs-mime.h> #include <libgnomevfs/gnome-vfs-utils.h> #include <glib/gi18n.h> @@ -55,17 +58,22 @@ #include "ephy-debug.h" #include "eel-gconf-extensions.h" -#include "ContentHandler.h" #include "MozDownload.h" #include "EphyUtils.h" +/* FIXME: we don't generally have a timestamp for the user action which initiated this + * content handler. + */ #ifdef MOZ_NSIMIMEINFO_NSACSTRING_ GContentHandler::GContentHandler() +: mUserTime(0) { LOG ("GContentHandler ctor (%p)", this); } #else -GContentHandler::GContentHandler() : mMimeType(nsnull) +GContentHandler::GContentHandler() +: mMimeType(nsnull) +, mUserTime(0) { LOG ("GContentHandler ctor (%p)", this); } @@ -156,6 +164,9 @@ NS_IMETHODIMP GContentHandler::PromptForSaveToFile( GTK_WINDOW (dialog)); } + /* FIXME: this will only be the real user time if we came from ::Show */ + ephy_gui_window_update_user_time (GTK_WIDGET (dialog), (guint32) mUserTime); + /* FIXME: modal -- mozilla sucks! */ do { @@ -267,7 +278,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction () { dialog = gtk_message_dialog_new (parentWindow, GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, /* translators: %s is the name of the application */ _("Open this file with \"%s\"?"), mHelperApp->name); @@ -283,7 +294,7 @@ NS_METHOD GContentHandler::MIMEConfirmAction () { dialog = gtk_message_dialog_new (parentWindow, GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Download the file?")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), @@ -312,6 +323,10 @@ NS_METHOD GContentHandler::MIMEConfirmAction () g_signal_connect_data (dialog, "response", G_CALLBACK (response_cb), this, (GClosureNotify) release_cb, (GConnectFlags) 0); + + /* FIXME: should find a way to get the user time of the user action which + * initiated this content handler + */ gtk_window_present (GTK_WINDOW (dialog)); return NS_OK; @@ -361,16 +376,30 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void) NS_METHOD GContentHandler::MIMEDoAction (void) { + /* This is okay, since we either clicked on a button, or we get 0 */ + mUserTime = gtk_get_current_event_time (); + nsCOMPtr<nsIMIMEInfo> mimeInfo; mLauncher->GetMIMEInfo(getter_AddRefs(mimeInfo)); NS_ENSURE_TRUE (mimeInfo, NS_ERROR_FAILURE); if (mAction == CONTENT_ACTION_OPEN) { - nsEmbedString desc; + g_return_val_if_fail (mHelperApp, NS_ERROR_FAILURE); + + const char *id; + id = gnome_vfs_mime_application_get_desktop_id (mHelperApp); + + /* The current time is fine here as the user has just clicked + * a button (it is used as the time for the application opening) + */ + char *info; + info = g_strdup_printf ("gnome-default:%d:%s", gtk_get_current_event_time(), id); - NS_CStringToUTF16 (nsEmbedCString ("gnome-default"), + nsEmbedString desc; + NS_CStringToUTF16 (nsEmbedCString (info), NS_CSTRING_ENCODING_UTF8, desc); + g_free (info); /* HACK we use the application description to ask MozDownload to open the file when download |