2007-12-16 22:20:24 +00:00
|
|
|
/*
|
2008-01-26 05:44:28 +00:00
|
|
|
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
|
2007-12-16 22:20:24 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
See the file COPYING for the full license text.
|
|
|
|
*/
|
|
|
|
|
2008-04-20 01:30:24 +00:00
|
|
|
#include "midori-preferences.h"
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-10-25 22:54:57 +00:00
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2007-12-16 22:20:24 +00:00
|
|
|
#include "sokoke.h"
|
|
|
|
|
2008-10-30 01:21:19 +00:00
|
|
|
#include <string.h>
|
2008-04-13 19:51:43 +00:00
|
|
|
#include <glib/gi18n.h>
|
2008-04-20 01:30:24 +00:00
|
|
|
|
2008-12-07 14:12:42 +00:00
|
|
|
#if HAVE_LIBSOUP
|
|
|
|
#include <libsoup/soup.h>
|
|
|
|
#endif
|
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
struct _MidoriPreferences
|
2008-04-20 01:30:24 +00:00
|
|
|
{
|
2008-06-19 18:41:05 +00:00
|
|
|
GtkDialog parent_instance;
|
|
|
|
|
2008-04-20 01:30:24 +00:00
|
|
|
GtkWidget* notebook;
|
|
|
|
};
|
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
G_DEFINE_TYPE (MidoriPreferences, midori_preferences, GTK_TYPE_DIALOG)
|
2008-04-20 01:30:24 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
|
|
|
|
PROP_SETTINGS
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_finalize (GObject* object);
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_set_property (GObject* object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue* value,
|
|
|
|
GParamSpec* pspec);
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_get_property (GObject* object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue* value,
|
|
|
|
GParamSpec* pspec);
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_class_init (MidoriPreferencesClass* class)
|
|
|
|
{
|
|
|
|
GObjectClass* gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
gobject_class->finalize = midori_preferences_finalize;
|
|
|
|
gobject_class->set_property = midori_preferences_set_property;
|
|
|
|
gobject_class->get_property = midori_preferences_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_SETTINGS,
|
|
|
|
g_param_spec_object (
|
|
|
|
"settings",
|
2008-10-15 01:32:11 +00:00
|
|
|
"Settings",
|
|
|
|
"Settings instance to provide properties",
|
2008-04-20 01:30:24 +00:00
|
|
|
MIDORI_TYPE_WEB_SETTINGS,
|
|
|
|
G_PARAM_WRITABLE));
|
|
|
|
}
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-10-03 22:46:54 +00:00
|
|
|
static void
|
|
|
|
midori_preferences_response_cb (MidoriPreferences* preferences,
|
|
|
|
gint response)
|
|
|
|
{
|
|
|
|
if (response == GTK_RESPONSE_CLOSE)
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (preferences));
|
|
|
|
}
|
|
|
|
|
2008-04-20 01:30:24 +00:00
|
|
|
static void
|
|
|
|
midori_preferences_init (MidoriPreferences* preferences)
|
2007-12-16 22:20:24 +00:00
|
|
|
{
|
2008-10-03 22:46:54 +00:00
|
|
|
gchar* dialog_title;
|
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
preferences->notebook = NULL;
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-10-20 06:50:16 +00:00
|
|
|
dialog_title = g_strdup_printf (_("Preferences for %s"),
|
2008-10-03 22:46:54 +00:00
|
|
|
g_get_application_name ());
|
2008-04-20 01:30:24 +00:00
|
|
|
g_object_set (preferences,
|
|
|
|
"icon-name", GTK_STOCK_PREFERENCES,
|
|
|
|
"title", dialog_title,
|
|
|
|
"has-separator", FALSE,
|
|
|
|
NULL);
|
2008-12-12 09:14:17 +00:00
|
|
|
g_free (dialog_title);
|
2009-01-10 19:13:08 +00:00
|
|
|
#if !HAVE_OSX
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_dialog_add_buttons (GTK_DIALOG (preferences),
|
|
|
|
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
|
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
|
|
|
NULL);
|
2008-10-15 22:58:22 +00:00
|
|
|
#endif
|
2008-04-20 01:30:24 +00:00
|
|
|
g_signal_connect (preferences, "response",
|
2008-10-03 22:46:54 +00:00
|
|
|
G_CALLBACK (midori_preferences_response_cb), NULL);
|
2008-04-20 01:30:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_finalize (GObject* object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (midori_preferences_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_set_property (GObject* object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue* value,
|
|
|
|
GParamSpec* pspec)
|
|
|
|
{
|
|
|
|
MidoriPreferences* preferences = MIDORI_PREFERENCES (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_SETTINGS:
|
|
|
|
{
|
|
|
|
midori_preferences_set_settings (preferences,
|
|
|
|
g_value_get_object (value));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_get_property (GObject* object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue* value,
|
|
|
|
GParamSpec* pspec)
|
|
|
|
{
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* midori_preferences_new:
|
|
|
|
* @parent: the parent window
|
|
|
|
* @settings: the settings
|
|
|
|
*
|
|
|
|
* Creates a new preferences dialog.
|
|
|
|
*
|
2008-12-12 09:14:17 +00:00
|
|
|
* Since 0.1.2 @parent may be %NULL.
|
|
|
|
*
|
2008-04-20 01:30:24 +00:00
|
|
|
* Return value: a new #MidoriPreferences
|
|
|
|
**/
|
|
|
|
GtkWidget*
|
|
|
|
midori_preferences_new (GtkWindow* parent,
|
|
|
|
MidoriWebSettings* settings)
|
|
|
|
{
|
2008-11-16 01:00:17 +00:00
|
|
|
MidoriPreferences* preferences;
|
|
|
|
|
2008-12-12 09:14:17 +00:00
|
|
|
g_return_val_if_fail (!parent || GTK_IS_WINDOW (parent), NULL);
|
2008-04-20 01:30:24 +00:00
|
|
|
g_return_val_if_fail (MIDORI_IS_WEB_SETTINGS (settings), NULL);
|
|
|
|
|
2008-11-16 01:00:17 +00:00
|
|
|
preferences = g_object_new (MIDORI_TYPE_PREFERENCES,
|
|
|
|
"transient-for", parent,
|
|
|
|
"settings", settings,
|
|
|
|
NULL);
|
2008-04-20 01:30:24 +00:00
|
|
|
|
|
|
|
return GTK_WIDGET (preferences);
|
|
|
|
}
|
|
|
|
|
2008-07-16 20:32:37 +00:00
|
|
|
static gboolean
|
|
|
|
proxy_download_manager_icon_cb (GtkWidget* entry,
|
|
|
|
GdkEventFocus* event,
|
|
|
|
GtkImage* icon)
|
|
|
|
{
|
2008-10-25 14:18:38 +00:00
|
|
|
const gchar* command;
|
|
|
|
gchar* first_space;
|
|
|
|
gchar* first_part;
|
2008-07-16 20:32:37 +00:00
|
|
|
gchar* path;
|
|
|
|
|
2008-10-25 14:18:38 +00:00
|
|
|
command = gtk_entry_get_text (GTK_ENTRY (entry));
|
|
|
|
if ((first_space = strstr (command, " ")))
|
|
|
|
first_part = g_strndup (command, first_space - command);
|
|
|
|
else
|
|
|
|
first_part = g_strdup (command);
|
|
|
|
path = g_find_program_in_path (first_part);
|
2008-07-16 20:32:37 +00:00
|
|
|
|
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
if (gtk_icon_theme_has_icon (gtk_icon_theme_get_for_screen (
|
2008-10-25 14:18:38 +00:00
|
|
|
gtk_widget_get_screen (entry)), first_part))
|
|
|
|
gtk_image_set_from_icon_name (icon, first_part, GTK_ICON_SIZE_MENU);
|
2008-07-16 20:32:37 +00:00
|
|
|
else
|
|
|
|
gtk_image_set_from_stock (icon, GTK_STOCK_EXECUTE, GTK_ICON_SIZE_MENU);
|
|
|
|
g_free (path);
|
|
|
|
}
|
2008-10-25 14:18:38 +00:00
|
|
|
else if (first_part && *first_part)
|
2008-07-16 20:32:37 +00:00
|
|
|
gtk_image_set_from_stock (icon, GTK_STOCK_STOP, GTK_ICON_SIZE_MENU);
|
|
|
|
else
|
|
|
|
gtk_image_clear (icon);
|
|
|
|
|
2008-10-25 14:18:38 +00:00
|
|
|
g_free (first_part);
|
|
|
|
|
2008-07-16 20:32:37 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-12-08 22:32:05 +00:00
|
|
|
static void
|
|
|
|
midori_preferences_notify_preferred_encoding_cb (MidoriWebSettings* settings,
|
|
|
|
GParamSpec* pspec,
|
|
|
|
GtkWidget* entry)
|
|
|
|
{
|
|
|
|
MidoriPreferredEncoding preferred_encoding;
|
|
|
|
|
|
|
|
preferred_encoding = katze_object_get_enum (settings, "preferred-encoding");
|
|
|
|
gtk_widget_set_sensitive (entry, preferred_encoding == MIDORI_ENCODING_CUSTOM);
|
|
|
|
}
|
|
|
|
|
2009-01-08 00:54:08 +00:00
|
|
|
#if HAVE_LIBSOUP
|
2008-12-08 22:18:14 +00:00
|
|
|
static void
|
|
|
|
midori_preferences_notify_identify_as_cb (MidoriWebSettings* settings,
|
|
|
|
GParamSpec* pspec,
|
|
|
|
GtkWidget* entry)
|
|
|
|
{
|
|
|
|
MidoriIdentity identify_as = katze_object_get_enum (settings, "identify-as");
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (entry, identify_as == MIDORI_IDENT_CUSTOM);
|
|
|
|
}
|
2008-12-09 19:04:04 +00:00
|
|
|
#endif
|
2008-12-08 22:18:14 +00:00
|
|
|
|
2009-01-09 21:54:40 +00:00
|
|
|
#if HAVE_OSX
|
2008-10-15 22:58:22 +00:00
|
|
|
static void
|
|
|
|
midori_preferences_help_clicked_cb (GtkWidget* button,
|
|
|
|
GtkDialog* dialog)
|
|
|
|
{
|
|
|
|
gtk_dialog_response (dialog, GTK_RESPONSE_HELP);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
midori_preferences_toolbutton_clicked_cb (GtkWidget* toolbutton,
|
|
|
|
GtkWidget* page)
|
|
|
|
{
|
|
|
|
gpointer notebook = g_object_get_data (G_OBJECT (toolbutton), "notebook");
|
|
|
|
guint n = gtk_notebook_page_num (notebook, page);
|
|
|
|
gtk_notebook_set_current_page (notebook, n);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
midori_preferences_add_toolbutton (GtkWidget* toolbar,
|
|
|
|
GtkWidget** toolbutton,
|
|
|
|
const gchar* icon,
|
|
|
|
const gchar* label,
|
|
|
|
GtkWidget* page)
|
|
|
|
{
|
2009-01-09 21:54:40 +00:00
|
|
|
#if HAVE_OSX
|
2008-10-15 22:58:22 +00:00
|
|
|
*toolbutton = GTK_WIDGET (*toolbutton ? gtk_radio_tool_button_new_from_widget (
|
|
|
|
GTK_RADIO_TOOL_BUTTON (*toolbutton)) : gtk_radio_tool_button_new (NULL));
|
|
|
|
gtk_tool_button_set_label (GTK_TOOL_BUTTON (*toolbutton), label);
|
|
|
|
gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (*toolbutton), icon);
|
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (*toolbutton), -1);
|
|
|
|
g_signal_connect (*toolbutton, "clicked",
|
|
|
|
G_CALLBACK (midori_preferences_toolbutton_clicked_cb), page);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-04-20 01:30:24 +00:00
|
|
|
/**
|
|
|
|
* midori_preferences_set_settings:
|
|
|
|
* @settings: the settings
|
|
|
|
*
|
|
|
|
* Assigns a settings instance to a preferences dialog.
|
|
|
|
*
|
|
|
|
* Note: This must not be called more than once.
|
2008-12-12 09:14:17 +00:00
|
|
|
*
|
|
|
|
* Since 0.1.2 this is equal to setting #MidoriPreferences:settings:.
|
2008-04-20 01:30:24 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
midori_preferences_set_settings (MidoriPreferences* preferences,
|
|
|
|
MidoriWebSettings* settings)
|
|
|
|
{
|
2008-12-12 09:14:17 +00:00
|
|
|
GtkWidget* header;
|
|
|
|
GtkWindow* parent;
|
|
|
|
const gchar* icon_name;
|
2008-07-16 20:32:37 +00:00
|
|
|
GtkSizeGroup* sizegroup;
|
2008-10-15 22:58:22 +00:00
|
|
|
GtkWidget* toolbar;
|
|
|
|
GtkWidget* toolbutton;
|
2008-07-16 20:32:37 +00:00
|
|
|
GtkWidget* page;
|
|
|
|
GtkWidget* frame;
|
|
|
|
GtkWidget* table;
|
|
|
|
GtkWidget* align;
|
|
|
|
GtkWidget* label;
|
|
|
|
GtkWidget* button;
|
|
|
|
GtkWidget* entry;
|
|
|
|
GtkWidget* hbox;
|
|
|
|
gint icon_width, icon_height;
|
|
|
|
|
2008-04-20 01:30:24 +00:00
|
|
|
g_return_if_fail (MIDORI_IS_PREFERENCES (preferences));
|
|
|
|
g_return_if_fail (MIDORI_IS_WEB_SETTINGS (settings));
|
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
g_return_if_fail (!preferences->notebook);
|
2008-04-20 01:30:24 +00:00
|
|
|
|
2008-12-12 09:14:17 +00:00
|
|
|
g_object_get (preferences, "transient-for", &parent, NULL);
|
|
|
|
icon_name = parent ? gtk_window_get_icon_name (parent) : NULL;
|
|
|
|
if ((header = sokoke_xfce_header_new (icon_name,
|
|
|
|
gtk_window_get_title (GTK_WINDOW (preferences)))))
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox),
|
|
|
|
header, FALSE, FALSE, 0);
|
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
preferences->notebook = gtk_notebook_new ();
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (preferences->notebook), 6);
|
2008-10-15 22:58:22 +00:00
|
|
|
|
2009-01-09 21:54:40 +00:00
|
|
|
#if HAVE_OSX
|
2008-10-15 22:58:22 +00:00
|
|
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (preferences->notebook), FALSE);
|
|
|
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (preferences->notebook), FALSE);
|
|
|
|
toolbar = gtk_toolbar_new ();
|
|
|
|
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);
|
|
|
|
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox),
|
|
|
|
toolbar, FALSE, FALSE, 0);
|
2008-10-25 22:54:57 +00:00
|
|
|
#else
|
2008-10-17 18:56:56 +00:00
|
|
|
toolbar = NULL;
|
2008-10-25 22:54:57 +00:00
|
|
|
#endif
|
2008-10-15 22:58:22 +00:00
|
|
|
toolbutton = NULL;
|
|
|
|
|
2008-09-10 23:49:01 +00:00
|
|
|
sizegroup = NULL;
|
2008-10-15 22:58:22 +00:00
|
|
|
#define PAGE_NEW(__icon, __label) \
|
|
|
|
page = gtk_vbox_new (FALSE, 0); \
|
|
|
|
midori_preferences_add_toolbutton (toolbar, &toolbutton, \
|
|
|
|
__icon, __label, page); \
|
|
|
|
if (toolbutton) g_object_set_data (G_OBJECT (toolbutton), \
|
|
|
|
"notebook", preferences->notebook); \
|
2008-09-10 23:49:01 +00:00
|
|
|
if (sizegroup) g_object_unref (sizegroup); \
|
|
|
|
sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); \
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (page), 4); \
|
2008-06-19 18:41:05 +00:00
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (preferences->notebook), page, \
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_label_new (__label))
|
|
|
|
#define FRAME_NEW(__label) frame = sokoke_hig_frame_new (__label); \
|
2008-09-10 23:49:01 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 4); \
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
|
|
|
#define TABLE_NEW(__rows, __cols) table = gtk_table_new ( \
|
|
|
|
__rows, __cols, FALSE); \
|
2008-09-10 23:49:01 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4); \
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
|
|
|
#define WIDGET_ADD(__widget, __left, __right, __top, __bottom) \
|
|
|
|
gtk_table_attach (GTK_TABLE (table), __widget \
|
|
|
|
, __left, __right, __top, __bottom \
|
2008-01-26 05:44:28 +00:00
|
|
|
, GTK_FILL, GTK_FILL, 8, 2)
|
2008-04-20 01:30:24 +00:00
|
|
|
#define FILLED_ADD(__widget, __left, __right, __top, __bottom) \
|
|
|
|
gtk_table_attach (GTK_TABLE (table), __widget \
|
2007-12-16 22:20:24 +00:00
|
|
|
, __left, __right, __top, __bottom\
|
|
|
|
, GTK_EXPAND | GTK_FILL, GTK_FILL, 8, 2)
|
2008-04-20 01:30:24 +00:00
|
|
|
#define INDENTED_ADD(__widget, __left, __right, __top, __bottom) \
|
|
|
|
align = gtk_alignment_new (0, 0.5, 0, 0); \
|
|
|
|
gtk_container_add (GTK_CONTAINER (align), __widget); \
|
|
|
|
gtk_size_group_add_widget (sizegroup, align); \
|
|
|
|
WIDGET_ADD (align, __left, __right, __top, __bottom)
|
|
|
|
#define SPANNED_ADD(__widget, __left, __right, __top, __bottom) \
|
|
|
|
align = gtk_alignment_new (0, 0.5, 0, 0); \
|
|
|
|
gtk_container_add (GTK_CONTAINER (align), __widget); \
|
|
|
|
FILLED_ADD (align, __left, __right, __top, __bottom)
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "General" */
|
2008-10-15 22:58:22 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_HOME, _("General"));
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Startup"));
|
2009-01-12 02:17:37 +00:00
|
|
|
TABLE_NEW (3, 2);
|
2008-04-13 19:51:43 +00:00
|
|
|
label = katze_property_label (settings, "load-on-startup");
|
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "load-on-startup", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
|
|
|
label = katze_property_label (settings, "homepage");
|
|
|
|
INDENTED_ADD (label, 0, 1, 1, 2);
|
2008-11-08 02:05:30 +00:00
|
|
|
/* TODO: We need something like "use current website" */
|
2008-04-13 19:51:43 +00:00
|
|
|
entry = katze_property_proxy (settings, "homepage", NULL);
|
|
|
|
FILLED_ADD (entry, 1, 2, 1, 2);
|
2009-01-12 02:17:37 +00:00
|
|
|
button = katze_property_proxy (settings, "show-crash-dialog", "blurb");
|
|
|
|
SPANNED_ADD (button, 0, 2, 2, 3);
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Transfers"));
|
2008-10-20 19:32:25 +00:00
|
|
|
TABLE_NEW (3, 2);
|
2008-04-13 19:51:43 +00:00
|
|
|
label = katze_property_label (settings, "download-folder");
|
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "download-folder", "folder");
|
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
2008-07-16 20:32:37 +00:00
|
|
|
label = katze_property_label (settings, "download-manager");
|
|
|
|
INDENTED_ADD (label, 0, 1, 1, 2);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
button = gtk_image_new ();
|
|
|
|
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
|
|
|
|
GTK_ICON_SIZE_MENU, &icon_width, &icon_height);
|
|
|
|
gtk_widget_set_size_request (button, icon_width, icon_height);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4);
|
|
|
|
entry = katze_property_proxy (settings, "download-manager", NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
|
|
|
proxy_download_manager_icon_cb (entry, NULL, GTK_IMAGE (button));
|
|
|
|
g_signal_connect (entry, "focus-out-event",
|
|
|
|
G_CALLBACK (proxy_download_manager_icon_cb), button);
|
|
|
|
FILLED_ADD (hbox, 1, 2, 1, 2);
|
2008-10-20 19:32:25 +00:00
|
|
|
label = katze_property_label (settings, "text-editor");
|
|
|
|
INDENTED_ADD (label, 0, 1, 2, 3);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
button = gtk_image_new ();
|
|
|
|
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
|
|
|
|
GTK_ICON_SIZE_MENU, &icon_width, &icon_height);
|
|
|
|
gtk_widget_set_size_request (button, icon_width, icon_height);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 4);
|
|
|
|
entry = katze_property_proxy (settings, "text-editor", NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
|
|
|
proxy_download_manager_icon_cb (entry, NULL, GTK_IMAGE (button));
|
|
|
|
g_signal_connect (entry, "focus-out-event",
|
|
|
|
G_CALLBACK (proxy_download_manager_icon_cb), button);
|
|
|
|
FILLED_ADD (hbox, 1, 2, 2, 3);
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "Appearance" */
|
2008-10-15 22:58:22 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_SELECT_FONT, _("Appearance"));
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Font settings"));
|
2008-12-08 22:32:05 +00:00
|
|
|
TABLE_NEW (6, 2);
|
2008-10-25 23:48:21 +00:00
|
|
|
label = gtk_label_new (_("Default Font Family"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
2008-04-20 16:12:39 +00:00
|
|
|
button = katze_property_proxy (settings, "default-font-family", "font");
|
2008-04-13 19:51:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
|
|
|
entry = katze_property_proxy (settings, "default-font-size", NULL);
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (entry, _("The default font size used to display text"));
|
2008-04-13 19:51:43 +00:00
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), entry, FALSE, FALSE, 4);
|
|
|
|
FILLED_ADD (hbox, 1, 2, 0, 1);
|
2008-10-25 23:48:21 +00:00
|
|
|
label = gtk_label_new (_("Minimum Font Size"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (label, 0, 1, 1, 2);
|
|
|
|
entry = katze_property_proxy (settings, "minimum-font-size", NULL);
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (entry, _("The minimum font size used to display text"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (entry, 1, 2, 1, 2);
|
|
|
|
label = katze_property_label (settings, "preferred-encoding");
|
|
|
|
INDENTED_ADD (label, 0, 1, 2, 3);
|
|
|
|
button = katze_property_proxy (settings, "preferred-encoding", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 2, 3);
|
2008-12-08 22:32:05 +00:00
|
|
|
label = katze_property_label (settings, "default-encoding");
|
|
|
|
gtk_label_set_label (GTK_LABEL (label), _("Encoding"));
|
|
|
|
INDENTED_ADD (label, 0, 1, 3, 4);
|
|
|
|
entry = katze_property_proxy (settings, "default-encoding", NULL);
|
|
|
|
gtk_widget_set_tooltip_text (entry, _("The character encoding to use by default"));
|
|
|
|
g_signal_connect (settings, "notify::preferred-encoding",
|
|
|
|
G_CALLBACK (midori_preferences_notify_preferred_encoding_cb), entry);
|
|
|
|
midori_preferences_notify_preferred_encoding_cb (settings, NULL, entry);
|
|
|
|
FILLED_ADD (entry, 1, 2, 3, 4);
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "Behavior" */
|
2008-10-15 22:58:22 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_SELECT_COLOR, _("Behavior"));
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Features"));
|
2008-06-08 16:42:39 +00:00
|
|
|
TABLE_NEW (6, 2);
|
2008-04-13 19:51:43 +00:00
|
|
|
button = katze_property_proxy (settings, "auto-load-images", NULL);
|
2008-10-25 23:48:21 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Load images automatically"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Load and display images automatically"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (button, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "auto-shrink-images", NULL);
|
2008-10-25 23:48:21 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Shrink images automatically"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Automatically shrink standalone images to fit"));
|
2008-04-13 19:51:43 +00:00
|
|
|
SPANNED_ADD (button, 1, 2, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "print-backgrounds", NULL);
|
2008-11-10 02:04:35 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Print background images"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Whether background images should be printed"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (button, 0, 1, 1, 2);
|
|
|
|
button = katze_property_proxy (settings, "resizable-text-areas", NULL);
|
2008-10-25 23:48:21 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Resizable text areas"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Whether text areas are resizable"));
|
2008-04-13 19:51:43 +00:00
|
|
|
SPANNED_ADD (button, 1, 2, 1, 2);
|
|
|
|
button = katze_property_proxy (settings, "enable-scripts", NULL);
|
2008-10-25 23:48:21 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Enable scripts"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Enable embedded scripting languages"));
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (button, 0, 1, 2, 3);
|
|
|
|
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
2008-11-01 18:19:28 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Enable plugins"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Enable embedded plugin objects"));
|
2008-09-10 23:49:01 +00:00
|
|
|
SPANNED_ADD (button, 1, 2, 2, 3);
|
2009-01-04 18:21:25 +00:00
|
|
|
button = katze_property_proxy (settings, "enforce-96-dpi", NULL);
|
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Enforce 96 dots per inch"));
|
|
|
|
gtk_widget_set_tooltip_text (button, _("Enforce a video dot density of 96 DPI"));
|
|
|
|
SPANNED_ADD (button, 0, 1, 3, 4);
|
2008-11-01 18:15:58 +00:00
|
|
|
button = katze_property_proxy (settings, "enable-developer-extras", NULL);
|
2008-11-02 23:17:43 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Enable developer tools"));
|
2009-01-04 18:21:25 +00:00
|
|
|
gtk_widget_set_tooltip_text (button, _("Enable special extensions for developers"));
|
2008-12-23 22:15:36 +00:00
|
|
|
SPANNED_ADD (button, 1, 2, 3, 4);
|
2008-04-13 19:51:43 +00:00
|
|
|
label = katze_property_label (settings, "location-entry-search");
|
2008-11-01 18:15:58 +00:00
|
|
|
INDENTED_ADD (label, 0, 1, 4, 5);
|
2008-04-13 19:51:43 +00:00
|
|
|
entry = katze_property_proxy (settings, "location-entry-search", NULL);
|
2008-11-01 18:15:58 +00:00
|
|
|
FILLED_ADD (entry, 1, 2, 4, 5);
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "Interface" */
|
2008-10-15 22:58:22 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Navigationbar"));
|
2008-10-21 22:01:01 +00:00
|
|
|
TABLE_NEW (3, 2);
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (katze_property_label (settings, "toolbar-style"), 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "toolbar-style", NULL);
|
2008-09-10 23:49:01 +00:00
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
2008-10-12 16:14:57 +00:00
|
|
|
INDENTED_ADD (katze_property_label (settings, "toolbar-items"), 0, 1, 1, 2);
|
|
|
|
button = katze_property_proxy (settings, "toolbar-items", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 1, 2);
|
2008-10-18 19:48:41 +00:00
|
|
|
button = gtk_label_new (NULL);
|
|
|
|
gtk_label_set_markup (GTK_LABEL (button),
|
|
|
|
"<span size='smaller'>"
|
2008-12-17 21:17:36 +00:00
|
|
|
"Separator, TabNew, Open, Print, Find, Location, Preferences, Window, Bookmarks\n"
|
2008-10-18 19:48:41 +00:00
|
|
|
"ReloadStop, ZoomIn, ZoomOut, Back, Forward, Homepage, Search, Trash"
|
|
|
|
"</span>");
|
2008-12-18 20:19:13 +00:00
|
|
|
gtk_label_set_selectable (GTK_LABEL (button), TRUE);
|
2008-10-18 19:48:41 +00:00
|
|
|
FILLED_ADD (button, 0, 2, 2, 3);
|
2008-09-10 23:49:01 +00:00
|
|
|
FRAME_NEW (_("Browsing"));
|
2008-12-02 01:00:55 +00:00
|
|
|
TABLE_NEW (5, 2);
|
|
|
|
label = katze_property_label (settings, "open-new-pages-in");
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "open-new-pages-in", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
|
|
|
label = katze_property_label (settings, "open-external-pages-in");
|
|
|
|
INDENTED_ADD (label, 0, 1, 1, 2);
|
|
|
|
button = katze_property_proxy (settings, "open-external-pages-in", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 1, 2);
|
2008-10-21 22:01:01 +00:00
|
|
|
button = katze_property_proxy (settings, "always-show-tabbar", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
INDENTED_ADD (button, 0, 1, 2, 3);
|
2008-10-21 22:01:01 +00:00
|
|
|
button = katze_property_proxy (settings, "compact-sidepanel", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
INDENTED_ADD (button, 1, 2, 2, 3);
|
2008-10-21 22:01:01 +00:00
|
|
|
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
INDENTED_ADD (button, 0, 1, 3, 4);
|
2008-04-13 19:51:43 +00:00
|
|
|
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
WIDGET_ADD (button, 1, 2, 3, 4);
|
2008-08-15 18:38:27 +00:00
|
|
|
/* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
SPANNED_ADD (button, 0, 1, 4, 5);*/
|
2008-08-15 18:38:27 +00:00
|
|
|
button = katze_property_proxy (settings, "open-tabs-next-to-current", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
WIDGET_ADD (button, 0, 1, 5, 6);
|
2008-04-13 19:51:43 +00:00
|
|
|
button = katze_property_proxy (settings, "close-buttons-on-tabs", NULL);
|
2008-12-02 01:00:55 +00:00
|
|
|
WIDGET_ADD (button, 1, 2, 5, 6);
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "Network" */
|
2009-01-08 00:54:08 +00:00
|
|
|
#if HAVE_LIBSOUP
|
2008-12-08 22:18:14 +00:00
|
|
|
/* If a cookie jar was created, WebKit is using Soup */
|
|
|
|
if (g_type_get_qdata (SOUP_TYPE_COOKIE_JAR,
|
|
|
|
g_quark_from_static_string ("midori-has-jar")))
|
|
|
|
{
|
2008-11-02 23:17:43 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("Network"));
|
2008-12-08 22:18:14 +00:00
|
|
|
TABLE_NEW (4, 2);
|
2008-04-13 19:51:43 +00:00
|
|
|
label = katze_property_label (settings, "http-proxy");
|
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "http-proxy", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
2008-12-08 22:18:14 +00:00
|
|
|
label = katze_property_label (settings, "identify-as");
|
2008-04-13 19:51:43 +00:00
|
|
|
INDENTED_ADD (label, 0, 1, 1, 2);
|
2008-12-08 22:18:14 +00:00
|
|
|
button = katze_property_proxy (settings, "identify-as", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 1, 2);
|
|
|
|
label = katze_property_label (settings, "ident-string");
|
|
|
|
INDENTED_ADD (label, 0, 1, 2, 3);
|
|
|
|
entry = katze_property_proxy (settings, "ident-string", NULL);
|
|
|
|
g_signal_connect (settings, "notify::identify-as",
|
|
|
|
G_CALLBACK (midori_preferences_notify_identify_as_cb), entry);
|
|
|
|
midori_preferences_notify_identify_as_cb (settings, NULL, entry);
|
|
|
|
FILLED_ADD (entry, 1, 2, 2, 3);
|
|
|
|
label = katze_property_label (settings, "cache-size");
|
|
|
|
INDENTED_ADD (label, 0, 1, 3, 4);
|
2008-04-13 19:51:43 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
entry = katze_property_proxy (settings, "cache-size", NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("MB")),
|
|
|
|
FALSE, FALSE, 0);
|
2008-12-08 22:18:14 +00:00
|
|
|
FILLED_ADD (hbox, 1, 2, 3, 4);
|
|
|
|
}
|
2008-11-02 23:17:43 +00:00
|
|
|
#endif
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-06-19 18:41:05 +00:00
|
|
|
/* Page "Privacy" */
|
2008-10-15 22:58:22 +00:00
|
|
|
PAGE_NEW (GTK_STOCK_INDEX, _("Privacy"));
|
2008-12-07 14:12:42 +00:00
|
|
|
#if HAVE_LIBSOUP_2_25_2
|
2008-12-08 22:18:14 +00:00
|
|
|
/* If a cookie jar was created, WebKit is using Soup */
|
|
|
|
if (g_type_get_qdata (SOUP_TYPE_COOKIE_JAR,
|
|
|
|
g_quark_from_static_string ("midori-has-jar")))
|
|
|
|
{
|
2008-11-02 23:17:43 +00:00
|
|
|
FRAME_NEW (_("Web Cookies"));
|
2008-04-13 19:51:43 +00:00
|
|
|
TABLE_NEW (3, 2);
|
|
|
|
label = katze_property_label (settings, "accept-cookies");
|
|
|
|
INDENTED_ADD (label, 0, 1, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "accept-cookies", NULL);
|
|
|
|
FILLED_ADD (button, 1, 2, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "original-cookies-only", "blurb");
|
|
|
|
SPANNED_ADD (button, 0, 2, 1, 2);
|
|
|
|
label = katze_property_label (settings, "maximum-cookie-age");
|
|
|
|
INDENTED_ADD (label, 0, 1, 2, 3);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
entry = katze_property_proxy (settings, "maximum-cookie-age", NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("days")),
|
|
|
|
FALSE, FALSE, 0);
|
2008-11-02 23:17:43 +00:00
|
|
|
FILLED_ADD (hbox, 1, 2, 2, 3);
|
2008-12-08 22:18:14 +00:00
|
|
|
}
|
2008-11-02 23:17:43 +00:00
|
|
|
#endif
|
2008-04-13 19:51:43 +00:00
|
|
|
FRAME_NEW (_("History"));
|
|
|
|
TABLE_NEW (3, 2);
|
|
|
|
button = katze_property_proxy (settings, "remember-last-visited-pages", NULL);
|
|
|
|
SPANNED_ADD (button, 0, 1, 0, 1);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
button = katze_property_proxy (settings, "maximum-history-age", NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("days")),
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
SPANNED_ADD (hbox, 1, 2, 0, 1);
|
|
|
|
button = katze_property_proxy (settings, "remember-last-form-inputs", NULL);
|
|
|
|
SPANNED_ADD (button, 0, 2, 1, 2);
|
|
|
|
button = katze_property_proxy (settings, "remember-last-downloaded-files", NULL);
|
2008-10-13 16:29:46 +00:00
|
|
|
SPANNED_ADD (button, 0, 2, 2, 3);
|
2007-12-16 22:20:24 +00:00
|
|
|
|
2008-09-10 23:49:01 +00:00
|
|
|
g_object_unref (sizegroup);
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (preferences)->vbox),
|
2008-06-19 18:41:05 +00:00
|
|
|
preferences->notebook, FALSE, FALSE, 4);
|
2009-01-09 21:54:40 +00:00
|
|
|
#if HAVE_OSX
|
2008-10-15 22:58:22 +00:00
|
|
|
GtkWidget* icon;
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
button = gtk_button_new ();
|
|
|
|
icon = gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_button_set_image (GTK_BUTTON (button), icon);
|
|
|
|
g_signal_connect (button, "clicked",
|
|
|
|
G_CALLBACK (midori_preferences_help_clicked_cb), preferences);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox),
|
|
|
|
button, FALSE, FALSE, 4);
|
|
|
|
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (preferences)->vbox),
|
|
|
|
hbox, FALSE, FALSE, 0);
|
|
|
|
#endif
|
2008-04-20 01:30:24 +00:00
|
|
|
gtk_widget_show_all (GTK_DIALOG (preferences)->vbox);
|
2007-12-16 22:20:24 +00:00
|
|
|
}
|