aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-11-16 23:11:45 +0800
committerXan Lopez <xan@src.gnome.org>2003-11-16 23:11:45 +0800
commit3adf5dd98cd8798dd1e2a1817a4f403976fdf41f (patch)
tree58b422df5512a6bda929dc6d5ce5fbfe2185987d
parent52ea620be10d0da3535e7667e3f28bd11c0f78d5 (diff)
downloadgsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar.gz
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar.bz2
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar.lz
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar.xz
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.tar.zst
gsoc2013-epiphany-3adf5dd98cd8798dd1e2a1817a4f403976fdf41f.zip
Implement UI for default download path and auto open downlads prefs for
* data/glade/prefs-dialog.glade: * src/prefs-dialog.c: (prefs_dialog_finalize), (get_download_button_label), (create_download_path_label), (prefs_dialog_init), (prefs_language_more_button_clicked_cb), (download_path_response_cb), (prefs_download_path_button_clicked_cb): Implement UI for default download path and auto open downlads prefs for the downloader.
-rw-r--r--ChangeLog12
-rw-r--r--data/glade/prefs-dialog.glade139
-rw-r--r--src/prefs-dialog.c105
3 files changed, 213 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 89fd85b34..192fb2688 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-11-16 Xan Lopez <xan@masilla.org>
+
+ * data/glade/prefs-dialog.glade:
+ * src/prefs-dialog.c: (prefs_dialog_finalize),
+ (get_download_button_label), (create_download_path_label),
+ (prefs_dialog_init), (prefs_language_more_button_clicked_cb),
+ (download_path_response_cb),
+ (prefs_download_path_button_clicked_cb):
+
+ Implement UI for default download path and auto open downlads
+ prefs for the downloader.
+
2003-11-15 Marco Pesenti Gritti <marco@gnome.org>
* configure.in:
diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade
index 1e64961ff..8d0f947de 100644
--- a/data/glade/prefs-dialog.glade
+++ b/data/glade/prefs-dialog.glade
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="gnome"/>
<widget class="GtkDialog" id="prefs_dialog">
<property name="border_width">5</property>
@@ -256,66 +255,40 @@
<property name="spacing">18</property>
<child>
- <widget class="GtkVBox" id="vbox159">
+ <widget class="GtkVBox" id="vbox183">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox145">
+ <widget class="GtkLabel" id="label1300">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label1253">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="label" translatable="yes">&lt;b&gt;Downloads&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox183">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox169">
+ <widget class="GtkHBox" id="hbox182">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkLabel" id="label1291">
+ <widget class="GtkLabel" id="label1301">
<property name="visible">True</property>
<property name="label" translatable="yes"> </property>
<property name="use_underline">False</property>
@@ -334,6 +307,86 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox197">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox183">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1302">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Download folder:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="download_path_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="prefs_download_path_button_clicked_cb"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="auto_open_downloads_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Automatically open &quot;safe&quot; downloads</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 207cdf083..bef0d0a4c 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -37,6 +37,7 @@
#include "ephy-langs.h"
#include "ephy-encodings.h"
#include "ephy-debug.h"
+#include "ephy-ellipsizing-label.h"
#include <glib/gi18n.h>
#include <gtk/gtkframe.h>
@@ -77,6 +78,10 @@ void
prefs_language_more_button_clicked_cb (GtkWidget *button,
EphyDialog *dialog);
+void
+prefs_download_path_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog);
+
static const
struct
{
@@ -194,6 +199,8 @@ enum
/* General */
HOMEPAGE_ENTRY_PROP,
+ AUTO_OPEN_PROP,
+ DOWNLOAD_PATH_BUTTON_PROP,
/* Fonts and Colors */
FONTS_LANGUAGE_PROP,
@@ -231,6 +238,8 @@ EphyDialogProperty properties [] =
/* General */
{ HOMEPAGE_ENTRY_PROP, "homepage_entry", CONF_GENERAL_HOMEPAGE, PT_AUTOAPPLY, NULL },
+ { AUTO_OPEN_PROP, "auto_open_downloads_checkbutton", CONF_AUTO_OPEN_DOWNLOADS, PT_AUTOAPPLY, NULL},
+ { DOWNLOAD_PATH_BUTTON_PROP, "download_path_button", NULL, PT_NORMAL, NULL },
/* Fonts and Colors */
{ FONTS_LANGUAGE_PROP, "fonts_language_optionmenu", CONF_FONTS_FOR_LANGUAGE, PT_AUTOAPPLY, NULL },
@@ -360,6 +369,11 @@ static void
prefs_dialog_finalize (GObject *object)
{
PrefsDialog *pd = EPHY_PREFS_DIALOG (object);
+ GtkWidget *button;
+
+ /* Free the ellipsizing label in the button */
+ button = ephy_dialog_get_control (EPHY_DIALOG (pd), DOWNLOAD_PATH_BUTTON_PROP);
+ gtk_widget_destroy (GTK_WIDGET (GTK_BIN (button)->child));
g_list_foreach (pd->priv->langs, (GFunc) free_lang_item, NULL);
g_list_free (pd->priv->langs);
@@ -987,7 +1001,46 @@ set_homepage_entry (EphyDialog *dialog,
&pos);
}
+static char*
+get_download_button_label ()
+{
+ char *label, *key, *desktop_path;
+
+ key = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
+ desktop_path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
+
+ if (!strcmp (key, desktop_path))
+ {
+ g_free (key);
+ label = g_strdup (_("Desktop"));
+ }
+ else
+ {
+ label = key;
+ }
+ g_free (desktop_path);
+ return label;
+}
+
+static void
+create_download_path_label (PrefsDialog *pd)
+{
+ char *dir;
+ GtkWidget *button, *label;
+ EphyDialog *dialog = EPHY_DIALOG (pd);
+
+ button = ephy_dialog_get_control (dialog, DOWNLOAD_PATH_BUTTON_PROP);
+
+ dir = get_download_button_label ();
+ label = ephy_ellipsizing_label_new (dir);
+ ephy_ellipsizing_label_set_mode ((EphyEllipsizingLabel*)label,
+ EPHY_ELLIPSIZE_START);
+ gtk_container_add (GTK_CONTAINER (button), label);
+ g_free (dir);
+ gtk_widget_show (label);
+}
+
static void
prefs_dialog_init (PrefsDialog *pd)
{
@@ -1043,6 +1096,7 @@ prefs_dialog_init (PrefsDialog *pd)
g_list_free (list);
create_language_menu (pd);
+ create_download_path_label (pd);
}
void
@@ -1204,3 +1258,54 @@ prefs_language_more_button_clicked_cb (GtkWidget *button,
ephy_dialog_show (EPHY_DIALOG(editor));
}
+
+static void
+download_path_response_cb (GtkDialog *fc, gint response, EphyDialog *dialog)
+{
+ if (response == GTK_RESPONSE_ACCEPT)
+ {
+ char *dir;
+
+ dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (fc));
+ if (dir != NULL)
+ {
+ GtkWidget *button;
+ char *label;
+
+ eel_gconf_set_string (CONF_STATE_DOWNLOAD_DIR, dir);
+
+ button = ephy_dialog_get_control (dialog, DOWNLOAD_PATH_BUTTON_PROP);
+ label = get_download_button_label ();
+ ephy_ellipsizing_label_set_text ((EphyEllipsizingLabel*)GTK_BIN (button)->child,
+ label);
+ g_free (dir);
+ g_free (label);
+ }
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (fc));
+}
+
+void
+prefs_download_path_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
+{
+ GtkWidget *parent, *fc;
+ parent = ephy_dialog_get_control (dialog, WINDOW_PROP);
+
+ fc = gtk_file_chooser_dialog_new (_("Select a directory"),
+ GTK_WINDOW (parent),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_folder_mode (GTK_FILE_CHOOSER (fc), TRUE);
+
+ g_signal_connect (GTK_DIALOG (fc), "response",
+ G_CALLBACK (download_path_response_cb),
+ dialog);
+
+ gtk_widget_show (fc);
+}