diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-01-24 17:56:44 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-01-24 17:56:44 +0800 |
commit | 180df7244c25e3034e0bf8bbc52b875ddb473816 (patch) | |
tree | cca5e34549076ff504b28ccd1297e641e232629a | |
parent | e6f14bc0bd721724d671104a719047203babb361 (diff) | |
download | gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar.gz gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar.bz2 gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar.lz gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar.xz gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.tar.zst gsoc2013-epiphany-180df7244c25e3034e0bf8bbc52b875ddb473816.zip |
Add a persist-position property.
2004-01-24 Marco Pesenti Gritti <marco@gnome.org>
* lib/ephy-dialog.c: (setup_default_size), (ephy_dialog_init),
(ephy_dialog_set_property), (ephy_dialog_get_property),
(ephy_dialog_class_init):
Add a persist-position property.
* embed/downloader-view.c: (downloader_view_new):
Persist downloader position.
* src/prefs-dialog.c: (get_download_button_label):
* embed/mozilla/MozDownload.cpp:
* data/epiphany.schemas.in:
Default to ~/Desktop/Downloads.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | embed/downloader-view.c | 5 | ||||
-rw-r--r-- | embed/mozilla/MozDownload.cpp | 11 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 22 | ||||
-rw-r--r-- | src/prefs-dialog.c | 8 |
5 files changed, 58 insertions, 6 deletions
@@ -1,3 +1,21 @@ +2004-01-24 Marco Pesenti Gritti <marco@gnome.org> + + * lib/ephy-dialog.c: (setup_default_size), (ephy_dialog_init), + (ephy_dialog_set_property), (ephy_dialog_get_property), + (ephy_dialog_class_init): + + Add a persist-position property. + + * embed/downloader-view.c: (downloader_view_new): + + Persist downloader position. + + * src/prefs-dialog.c: (get_download_button_label): + * embed/mozilla/MozDownload.cpp: + * data/epiphany.schemas.in: + + Default to ~/Desktop/Downloads. + 2004-01-23 Marco Pesenti Gritti <marco@gnome.org> * data/epiphany.schemas.in: diff --git a/embed/downloader-view.c b/embed/downloader-view.c index f79f5c2c0..6830fe1e9 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -210,8 +210,9 @@ downloader_view_finalize (GObject *object) DownloaderView * downloader_view_new (void) { - return EPHY_DOWNLOADER_VIEW (g_object_new - (EPHY_TYPE_DOWNLOADER_VIEW, NULL)); + return EPHY_DOWNLOADER_VIEW (g_object_new (EPHY_TYPE_DOWNLOADER_VIEW, + "persist-position", TRUE, + NULL)); } static char * diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp index 6808c0251..d6f278940 100644 --- a/embed/mozilla/MozDownload.cpp +++ b/embed/mozilla/MozDownload.cpp @@ -50,6 +50,7 @@ #include "eel-gconf-extensions.h" #include "ephy-prefs.h" #include <libgnomevfs/gnome-vfs-utils.h> +#include <glib/gi18n.h> #include "nsIExternalHelperAppService.h" #include "nsDirectoryServiceDefs.h" @@ -537,14 +538,22 @@ nsresult InitiateMozillaDownload (nsIDOMDocument *domDocument, nsIURI *sourceURI static char* GetFilePath (const char *filename) { - char *path, *download_dir, *expanded; + char *path, *download_dir, *expanded, *tmp; download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR); + if (!download_dir) { /* Emergency download destination */ download_dir = g_strdup (g_get_home_dir ()); } + else if (g_utf8_collate (download_dir, "Downloads") == 0) + { + tmp = g_build_filename (g_get_home_dir (), "Desktop", + _("Downloads"), NULL); + g_free (download_dir); + download_dir = tmp; + } expanded = gnome_vfs_expand_initial_tilde (download_dir); path = g_build_filename (expanded, filename, NULL); diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 61af99312..4d1fd9e17 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -43,7 +43,8 @@ enum { PROP_0, PROP_PARENT_WINDOW, - PROP_MODAL + PROP_MODAL, + PROP_PERSIST_POSITION }; typedef enum @@ -84,6 +85,7 @@ struct EphyDialogPrivate gboolean has_default_size; gboolean disposing; gboolean initialized; + gboolean persist_position; }; #define SPIN_DELAY 0.20 @@ -968,6 +970,8 @@ setup_default_size (EphyDialog *dialog) { ephy_state_add_window (dialog->priv->dialog, dialog->priv->name, -1, -1, + dialog->priv->persist_position ? + EPHY_STATE_WINDOW_SAVE_POSITION : EPHY_STATE_WINDOW_SAVE_SIZE); dialog->priv->has_default_size = TRUE; @@ -1274,6 +1278,7 @@ ephy_dialog_init (EphyDialog *dialog) dialog->priv->initialized = FALSE; dialog->priv->has_default_size = FALSE; dialog->priv->disposing = FALSE; + dialog->priv->persist_position = FALSE; dialog->priv->props = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) free_prop_info); @@ -1329,6 +1334,9 @@ ephy_dialog_set_property (GObject *object, case PROP_MODAL: ephy_dialog_set_modal (dialog, g_value_get_boolean (value)); break; + case PROP_PERSIST_POSITION: + dialog->priv->persist_position = g_value_get_boolean (value); + break; } } @@ -1347,6 +1355,10 @@ ephy_dialog_get_property (GObject *object, break; case PROP_MODAL: g_value_set_boolean (value, dialog->priv->modal); + break; + case PROP_PERSIST_POSITION: + g_value_set_boolean (value, dialog->priv->persist_position); + break; } } @@ -1392,6 +1404,14 @@ ephy_dialog_class_init (EphyDialogClass *klass) FALSE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_PERSIST_POSITION, + g_param_spec_boolean ("persist-position", + "Persist position", + "Persist dialog position", + FALSE, + G_PARAM_READWRITE)); + g_type_class_add_private (object_class, sizeof (EphyDialogPrivate)); } diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 24abf552f..883406862 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1084,9 +1084,11 @@ create_language_section (EphyDialog *dialog) static char* get_download_button_label () { - char *key, *label; + char *key, *label, *downloads_path; key = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR); + downloads_path = g_build_path (g_get_home_dir (), "Desktop", + _("Downloads"), NULL); if (g_utf8_collate (key, "~/Desktop") == 0) { @@ -1102,7 +1104,7 @@ get_download_button_label () * filechooser */ label = g_strdup (_("Home")); } - else if (g_utf8_collate (key, "~/Downloads") == 0) + else if (g_utf8_collate (key, downloads_path) == 0) { g_free (key); label = g_strdup (_("Downloads")); @@ -1112,6 +1114,8 @@ get_download_button_label () label = key; } + g_free (downloads_path); + return label; } |