aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed-utils.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-10-26 18:45:56 +0800
committerChristian Persch <chpe@src.gnome.org>2003-10-26 18:45:56 +0800
commiteb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b (patch)
tree9c1ae176d61be345a8d3295aa9e43e48a43464da /embed/ephy-embed-utils.c
parenta34a545dbe35d250c5f5743634909ad2a45f423b (diff)
downloadgsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar.gz
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar.bz2
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar.lz
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar.xz
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.tar.zst
gsoc2013-epiphany-eb6b2cdb2e89e41759cf3b1cd136cfca42e6e42b.zip
Port to new gtk+ file chooser.
2003-10-26 Christian Persch <chpe@cvs.gnome.org> Port to new gtk+ file chooser. * data/epiphany.schemas.in: * lib/ephy-prefs.h: Add key for remembering upload path. * embed /Makefile.am: * embed/downloader-view.c: * embed/ephy-embed-persist.c: (ephy_embed_persist_get_type), (ephy_embed_persist_set_dest), (ephy_embed_persist_set_embed), (ephy_embed_persist_set_fc_title), (ephy_embed_persist_set_fc_parent), (ephy_embed_persist_set_flags), (ephy_embed_persist_set_max_size), (ephy_embed_persist_set_persist_key), (ephy_embed_persist_set_source), (ephy_embed_persist_get_dest), (ephy_embed_persist_get_embed), (ephy_embed_persist_get_fc_title), (ephy_embed_persist_get_fc_parent), (ephy_embed_persist_get_flags), (ephy_embed_persist_get_max_size), (ephy_embed_persist_get_persist_key), (ephy_embed_persist_get_source), (ephy_embed_persist_set_property), (ephy_embed_persist_get_property), (ephy_embed_persist_init), (ephy_embed_persist_finalize), (ephy_embed_persist_class_init), (ephy_embed_persist_cancel), (ephy_embed_persist_save), (ephy_embed_persist_new): * embed/ephy-embed-persist.h: * embed/ephy-embed-popup-control.c: (save_url), (save_property_url), (background_download_completed), (embed_popup_set_image_as_background_cmd), (embed_popup_copy_image_location_cmd): * src/popup-commands.c: (save_property_url), (background_download_completed), (popup_cmd_set_image_as_background): * src/window-commands.c: (open_response_cb), (window_cmd_file_open), (window_cmd_file_save_as): * src/window-commands.h: * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get_type), (ephy_favicon_cache_new), (icon_is_obsolete), (icons_added_cb), (remove_obsolete_icons), (ephy_favicon_cache_init), (favicon_download_completed_cb), (ephy_favicon_cache_download), (ephy_favicon_cache_get): * embed/mozilla/MozDownload.cpp: * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed-single.cpp: * src/popup-commands.c: (save_property_url), (background_download_completed), (popup_cmd_set_image_as_background): * src/window-commands.c: (open_response_cb), (window_cmd_file_open), (window_cmd_file_save_as): * src/window-commands.h: Simplify EphyEmbedPersist implementation. Augment it with properties for showing a file chooser to select persist destination. Port all callers to new interfaces. * embed/ephy-embed-single.c: (ephy_embed_single_remove_passwords): * embed/ephy-embed-single.h: * embed/ephy-embed-utils.c: * embed/ephy-embed-utils.h: Obsolete and removed. * embed/mozilla/ContentHandler.cpp: * embed/mozilla/ContentHandler.h: Misc cleanups. * embed/mozilla/FilePicker.cpp: * embed/mozilla/FilePicker.h: Port to new file chooser class. * embed/mozilla/Makefile.am: * lib/Makefile.am: * lib/ephy-file-chooser.c: (ephy_file_chooser_get_type), (current_folder_changed_cb), (ephy_file_chooser_init), (ephy_file_chooser_finalize), (ephy_file_chooser_set_persist_key), (ephy_file_chooser_set_property), (ephy_file_chooser_get_property), (ephy_file_chooser_class_init), (ephy_file_chooser_new): * lib/ephy-file-chooser.h: * src/bookmarks/ephy-bookmarks-editor.c: (import_from_file_response_cb), (import_dialog_response_cb): New file chooser wrapper class; ported file chooser callers to it.
Diffstat (limited to 'embed/ephy-embed-utils.c')
-rw-r--r--embed/ephy-embed-utils.c214
1 files changed, 0 insertions, 214 deletions
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
deleted file mode 100644
index 0bcd6bb52..000000000
--- a/embed/ephy-embed-utils.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "eel-gconf-extensions.h"
-#include "ephy-embed-utils.h"
-#include "ephy-embed-shell.h"
-#include "ephy-bonobo-extensions.h"
-#include "ephy-gui.h"
-#include "ephy-debug.h"
-#include "ephy-langs.h"
-
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkmessagedialog.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
-#include <string.h>
-
-/**
- * ephy_embed_utils_save:
- * @window: the referrer window. Used to parent the dialogs.
- * @title: title of the file picker
- * @default_dir_pref: the gconf path to persist the directory selected by the user.
- * @ask_dest: ask the user the destination path
- * @ask_content: show the user an option to save the content
- * of the web page (images, javascript...)
- * @persist: the #EphyEmbedPersist referring to the url
- *
- * Download a save an url asking a location to the user when requested
- **/
-void
-ephy_embed_utils_save (GtkWidget *window,
- const char *title,
- const char *default_dir_pref,
- gboolean ask_dest,
- EphyEmbedPersist *persist)
-{
- GnomeVFSURI *uri;
- char *retPath = NULL;
- char *fileName = NULL;
- char *dirName = NULL;
- char *target;
- const char *source;
- gresult ret;
- EphyEmbed *embed;
- EmbedPersistFlags flags;
- EphyEmbedSingle *single;
-
- single = ephy_embed_shell_get_embed_single
- (EPHY_EMBED_SHELL (embed_shell));
-
- g_object_ref (G_OBJECT(persist));
-
- ephy_embed_persist_get_flags (persist, &flags);
-
- ephy_embed_persist_get_source (persist, &source);
-
- if (source)
- {
- target = g_strdup (source);
- }
- else
- {
- ephy_embed_persist_get_embed (persist, &embed);
- g_return_if_fail (embed != NULL);
-
- ephy_embed_get_location (embed,
- flags &
- EMBED_PERSIST_MAINDOC,
- &target);
- }
-
- /* Get a filename from the target url */
- uri = gnome_vfs_uri_new (target);
- if (uri)
- {
- fileName = gnome_vfs_uri_extract_short_name (uri);
- gnome_vfs_uri_unref (uri);
- }
-
- dirName = eel_gconf_get_string (default_dir_pref);
- if (dirName && dirName[0] == '\0')
- {
- g_free (dirName);
- dirName = NULL;
- }
-
- if (!dirName || strcmp (dirName,"~") == 0)
- {
- g_free (dirName);
- dirName = g_strdup(g_get_home_dir ());
- }
-
- /* If we aren't asking for downloading dir, check that we aren't
- * overwriting anything. If we are, pop up a warning dialog and show
- * the filepicker if the user doesn't want to overwrite the file.
- */
- ret = G_FAILED;
- if (!ask_dest)
- {
- retPath = g_build_filename (dirName, fileName, NULL);
- if (ephy_gui_confirm_overwrite_file (window, retPath))
- {
- ret = G_OK;
- }
- else
- {
- g_free (retPath);
- retPath = NULL;
- ask_dest = TRUE;
- }
- }
-
- if (ask_dest)
- {
- char *ret_dir;
-
- /* show the file picker */
- ret = ephy_embed_single_show_file_picker
- (single, window, title,
- dirName, fileName, modeSave, &retPath,
- NULL, NULL);
-
- if (g_file_test (retPath, G_FILE_TEST_IS_DIR))
- {
- ret_dir = g_strdup (retPath);
- }
- else
- {
- ret_dir = g_path_get_dirname (retPath);
- }
-
- /* set default save dir */
- eel_gconf_set_string (default_dir_pref, ret_dir);
- g_free (ret_dir);
- }
-
- if (ret == G_OK)
- {
- ephy_embed_persist_set_flags (persist, flags);
-
- ephy_embed_persist_set_dest (persist, retPath);
-
- if (ephy_embed_persist_save (persist) == G_FAILED)
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new
- (GTK_WINDOW (window),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("The file has not been saved."));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- }
-
- }
-
- g_free (retPath);
-
- g_object_unref (G_OBJECT(persist));
-
- g_free (dirName);
- g_free (fileName);
- g_free (target);
-}
-
-/**
- * ephy_embed_utils_handlernotfound_dialog_run:
- * @parent: the dialog parent window
- *
- * Show a dialog to warn the user that no application capable
- * to open the specified file are found. Used in the downloader
- * and in the mime type dialog.
- **/
-void
-ephy_embed_utils_nohandler_dialog_run (GtkWidget *parent)
-{
- GtkWidget *dialog;
-
- /* FIXME mime db shortcut */
-
- dialog = gtk_message_dialog_new
- (GTK_WINDOW(parent),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("No available applications to open "
- "the specified file."));
- gtk_dialog_run (GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
-}