Remove old configuration logic entirely
Almost all uses of the old system were superseded by the use of MidoriWebSettings now, the migration is almost finished.
This commit is contained in:
parent
cdde1293ab
commit
169973f3fe
11 changed files with 458 additions and 371 deletions
|
@ -1,7 +1,6 @@
|
|||
# List of source files containing translatable strings.
|
||||
|
||||
midori.desktop.in
|
||||
src/conf.c
|
||||
src/helpers.c
|
||||
src/main.c
|
||||
src/midori-console.c
|
||||
|
|
|
@ -28,7 +28,6 @@ midori_SOURCES = \
|
|||
webSearch.c webSearch.h \
|
||||
helpers.c helpers.h \
|
||||
sokoke.c sokoke.h \
|
||||
conf.c conf.h \
|
||||
search.c search.h \
|
||||
global.h \
|
||||
ui.h \
|
||||
|
|
70
src/conf.c
70
src/conf.c
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "sokoke.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
CConfig* config_new(void)
|
||||
{
|
||||
return g_new0(CConfig, 1);
|
||||
}
|
||||
|
||||
void config_free(CConfig* config)
|
||||
{
|
||||
g_free(config->homepage);
|
||||
g_free(config->locationSearch);
|
||||
g_free(config->panelPageholder);
|
||||
g_free(config);
|
||||
}
|
||||
|
||||
gboolean config_from_file(CConfig* config, const gchar* filename, GError** error)
|
||||
{
|
||||
GKeyFile* keyFile = g_key_file_new();
|
||||
g_key_file_load_from_file(keyFile, filename, G_KEY_FILE_KEEP_COMMENTS, error);
|
||||
|
||||
#define GET_INT(var, key, default) \
|
||||
var = sokoke_key_file_get_integer_default( \
|
||||
keyFile, "session", key, default, NULL)
|
||||
#define GET_STR(var, key, default) \
|
||||
var = sokoke_key_file_get_string_default( \
|
||||
keyFile, "session", key, default, NULL)
|
||||
GET_INT(config->rememberWinSize, "RememberWinSize", TRUE);
|
||||
GET_INT(config->winWidth, "WinWidth", 0);
|
||||
GET_INT(config->winHeight, "WinHeight", 0);
|
||||
GET_INT(config->winPanelPos, "WinPanelPos", 0);
|
||||
GET_INT(config->searchEngine, "SearchEngine", 0);
|
||||
#undef GET_INT
|
||||
#undef GET_STR
|
||||
|
||||
g_key_file_free(keyFile);
|
||||
return !(error && *error);
|
||||
}
|
||||
|
||||
gboolean config_to_file(CConfig* config, const gchar* filename, GError** error)
|
||||
{
|
||||
GKeyFile* keyFile = g_key_file_new();
|
||||
|
||||
g_key_file_set_integer(keyFile, "session", "RememberWinSize", config->rememberWinSize);
|
||||
g_key_file_set_integer(keyFile, "session", "WinWidth", config->winWidth);
|
||||
g_key_file_set_integer(keyFile, "session", "WinHeight", config->winHeight);
|
||||
g_key_file_set_integer(keyFile, "session", "WinPanelPos", config->winPanelPos);
|
||||
g_key_file_set_integer(keyFile, "session", "SearchEngine", config->searchEngine);
|
||||
|
||||
gboolean saved = sokoke_key_file_save_to_file(keyFile, filename, error);
|
||||
g_key_file_free(keyFile);
|
||||
|
||||
return saved;
|
||||
}
|
96
src/conf.h
96
src/conf.h
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef __CONF_H__
|
||||
#define __CONF_H__ 1
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _CConfig
|
||||
{
|
||||
guint startup;
|
||||
gchar* homepage;
|
||||
gchar* locationSearch;
|
||||
gboolean toolbarNavigation;
|
||||
gboolean toolbarBookmarks;
|
||||
//gboolean toolbarDownloads;
|
||||
gboolean toolbarStatus;
|
||||
guint toolbarStyle;
|
||||
gboolean toolbarSmall;
|
||||
gboolean panelShow;
|
||||
guint panelActive;
|
||||
gchar* panelPageholder;
|
||||
guint tabSize; // tab size in charcters
|
||||
gboolean tabClose;
|
||||
gboolean toolbarWebSearch;
|
||||
gboolean toolbarNewTab;
|
||||
gboolean toolbarClosedTabs;
|
||||
guint newPages; // where to open new pages
|
||||
gboolean openTabsInTheBackground;
|
||||
gboolean openPopupsInTabs;
|
||||
gboolean middleClickGoto;
|
||||
|
||||
gchar* defaultFontFamily;
|
||||
guint defaultFontSize;
|
||||
guint minimumFontSize;
|
||||
gchar* defaultEncoding;
|
||||
gboolean autoLoadImages;
|
||||
gboolean autoShrinkImages;
|
||||
gboolean printBackgrounds;
|
||||
gboolean resizableTextAreas;
|
||||
gboolean userStylesheet;
|
||||
gchar* userStylesheetUri;
|
||||
gboolean enableScripts;
|
||||
gboolean enablePlugins;
|
||||
|
||||
gboolean rememberWinSize; // Restore window size upon startup?
|
||||
gint winWidth;
|
||||
gint winHeight;
|
||||
guint winPanelPos;
|
||||
guint searchEngine; // last selected search engine
|
||||
} CConfig;
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_STARTUP_BLANK,
|
||||
CONFIG_STARTUP_HOMEPAGE,
|
||||
CONFIG_STARTUP_SESSION
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_TOOLBAR_DEFAULT,
|
||||
CONFIG_TOOLBAR_ICONS,
|
||||
CONFIG_TOOLBAR_TEXT,
|
||||
CONFIG_TOOLBAR_BOTH,
|
||||
CONFIG_TOOLBAR_BOTH_HORIZ
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CONFIG_NEWPAGES_TAB_NEW,
|
||||
CONFIG_NEWPAGES_WINDOW_NEW,
|
||||
CONFIG_NEWPAGES_TAB_CURRENT
|
||||
};
|
||||
|
||||
CConfig*
|
||||
config_new(void);
|
||||
|
||||
void
|
||||
config_free(CConfig*);
|
||||
|
||||
gboolean
|
||||
config_from_file(CConfig*, const gchar*, GError**);
|
||||
|
||||
gboolean
|
||||
config_to_file(CConfig*, const gchar*, GError**);
|
||||
|
||||
#endif /* !__CONF_H__ */
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef __GLOBAL_H__
|
||||
#define __GLOBAL_H__ 1
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "midori-websettings.h"
|
||||
#include <katze/katze.h>
|
||||
|
||||
|
@ -26,8 +24,6 @@
|
|||
|
||||
GList* searchEngines; // Items of type 'SearchEngine'
|
||||
KatzeXbelItem* bookmarks;
|
||||
CConfig* config;
|
||||
MidoriWebSettings* webSettings;
|
||||
|
||||
// Custom stock items
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ gchar* magic_uri(const gchar* uri, gboolean search)
|
|||
//g_strfreev(sParts);
|
||||
// We only have a word or there is no matching keyowrd, so search for it
|
||||
if(searchUrl == NULL)
|
||||
g_snprintf(search, 255, config->locationSearch, uri);
|
||||
g_snprintf(search, 255, ""/*config->locationSearch*/, uri);
|
||||
return g_strdup(search);
|
||||
}
|
||||
return g_strdup(uri);
|
||||
|
@ -143,27 +143,3 @@ gchar* get_default_font(void)
|
|||
g_object_get(gtksettings, "gtk-font-name", &defaultFont, NULL);
|
||||
return defaultFont;
|
||||
}
|
||||
|
||||
GtkToolbarStyle config_to_toolbarstyle(guint toolbarStyle)
|
||||
{
|
||||
switch(toolbarStyle)
|
||||
{
|
||||
case CONFIG_TOOLBAR_ICONS:
|
||||
return GTK_TOOLBAR_ICONS;
|
||||
case CONFIG_TOOLBAR_TEXT:
|
||||
return GTK_TOOLBAR_TEXT;
|
||||
case CONFIG_TOOLBAR_BOTH:
|
||||
return GTK_TOOLBAR_BOTH;
|
||||
case CONFIG_TOOLBAR_BOTH_HORIZ:
|
||||
return GTK_TOOLBAR_BOTH_HORIZ;
|
||||
}
|
||||
GtkSettings* gtkSettings = gtk_settings_get_default();
|
||||
g_object_get(gtkSettings, "gtk-toolbar-style", &toolbarStyle, NULL);
|
||||
return toolbarStyle;
|
||||
}
|
||||
|
||||
GtkToolbarStyle config_to_toolbariconsize(gboolean toolbarSmall)
|
||||
{
|
||||
return toolbarSmall ? GTK_ICON_SIZE_SMALL_TOOLBAR
|
||||
: GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,4 @@ magic_uri(const gchar*, gboolean bSearch);
|
|||
gchar*
|
||||
get_default_font(void);
|
||||
|
||||
GtkToolbarStyle
|
||||
config_to_toolbarstyle();
|
||||
|
||||
GtkToolbarStyle
|
||||
config_to_toolbariconsize(gboolean);
|
||||
|
||||
#endif /* !__HELPERS_H__ */
|
||||
|
|
34
src/main.c
34
src/main.c
|
@ -259,6 +259,9 @@ settings_save_to_file (MidoriWebSettings* settings,
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
MidoriStartup load_on_startup;
|
||||
gchar* homepage;
|
||||
|
||||
locale_init();
|
||||
g_set_application_name(_("midori"));
|
||||
|
||||
|
@ -267,7 +270,8 @@ int main(int argc, char** argv)
|
|||
GOptionEntry entries[] =
|
||||
{
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version,
|
||||
N_("Display program version"), NULL }
|
||||
N_("Display program version"), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
GError* error = NULL;
|
||||
|
@ -310,7 +314,6 @@ int main(int argc, char** argv)
|
|||
gchar* config_file = g_build_filename (config_path, "config", NULL);
|
||||
error = NULL;
|
||||
MidoriWebSettings* settings = settings_new_from_file (config_file);
|
||||
webSettings = settings;
|
||||
katze_assign (config_file, g_build_filename (config_path, "accels", NULL));
|
||||
gtk_accel_map_load (config_file);
|
||||
katze_assign (config_file, g_build_filename (config_path, "search", NULL));
|
||||
|
@ -337,9 +340,9 @@ int main(int argc, char** argv)
|
|||
g_error_free (error);
|
||||
}
|
||||
g_free (config_file);
|
||||
KatzeXbelItem* _session = katze_xbel_folder_new();
|
||||
config = config_new ();
|
||||
if(config->startup == CONFIG_STARTUP_SESSION)
|
||||
KatzeXbelItem* _session = katze_xbel_folder_new ();
|
||||
g_object_get (settings, "load-on-startup", &load_on_startup, NULL);
|
||||
if (load_on_startup == MIDORI_STARTUP_LAST_OPEN_PAGES)
|
||||
{
|
||||
config_file = g_build_filename (config_path, "session.xbel", NULL);
|
||||
error = NULL;
|
||||
|
@ -382,7 +385,6 @@ int main(int argc, char** argv)
|
|||
, NULL);
|
||||
if(gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
config_free(config);
|
||||
search_engines_free(searchEngines);
|
||||
katze_xbel_item_unref(bookmarks);
|
||||
katze_xbel_item_unref(_session);
|
||||
|
@ -410,14 +412,18 @@ int main(int argc, char** argv)
|
|||
}
|
||||
g_free(uri);
|
||||
|
||||
if(katze_xbel_folder_is_empty(_session))
|
||||
if (katze_xbel_folder_is_empty (_session))
|
||||
{
|
||||
KatzeXbelItem* item = katze_xbel_bookmark_new();
|
||||
if(config->startup == CONFIG_STARTUP_BLANK)
|
||||
katze_xbel_bookmark_set_href(item, "");
|
||||
KatzeXbelItem* item = katze_xbel_bookmark_new ();
|
||||
if (load_on_startup == MIDORI_STARTUP_BLANK)
|
||||
katze_xbel_bookmark_set_href (item, "");
|
||||
else
|
||||
katze_xbel_bookmark_set_href(item, config->homepage);
|
||||
katze_xbel_folder_prepend_item(_session, item);
|
||||
{
|
||||
g_object_get (settings, "homepage", &homepage, NULL);
|
||||
katze_xbel_bookmark_set_href (item, homepage);
|
||||
g_free (homepage);
|
||||
}
|
||||
katze_xbel_folder_prepend_item (_session, item);
|
||||
}
|
||||
g_free (config_path);
|
||||
|
||||
|
@ -493,7 +499,8 @@ int main(int argc, char** argv)
|
|||
g_error_free (error);
|
||||
}
|
||||
katze_xbel_item_unref (xbel_trash);
|
||||
if(config->startup == CONFIG_STARTUP_SESSION)
|
||||
g_object_get (settings, "load-on-startup", &load_on_startup, NULL);
|
||||
if(load_on_startup == MIDORI_STARTUP_LAST_OPEN_PAGES)
|
||||
{
|
||||
katze_assign (config_file, g_build_filename (config_path,
|
||||
"session.xbel", NULL));
|
||||
|
@ -512,7 +519,6 @@ int main(int argc, char** argv)
|
|||
g_warning ("The configuration couldn't be saved. %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
config_free (config);
|
||||
katze_assign (config_file, g_build_filename (config_path, "accels", NULL));
|
||||
gtk_accel_map_save (config_file);
|
||||
g_free (config_file);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "midori-browser.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "conf.h"
|
||||
#include "helpers.h"
|
||||
#include "webSearch.h"
|
||||
#include "prefs.h"
|
||||
|
@ -25,6 +24,7 @@
|
|||
#include "midori-console.h"
|
||||
#include "midori-trash.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libsexy/sexy.h>
|
||||
|
@ -796,10 +796,16 @@ midori_browser_navigationbar_notify_style_cb (GObject* object,
|
|||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
if (config->toolbarStyle == CONFIG_TOOLBAR_DEFAULT)
|
||||
MidoriToolbarStyle toolbar_style;
|
||||
GtkToolbarStyle gtk_toolbar_style;
|
||||
|
||||
g_object_get (priv->settings, "toolbar-style", &toolbar_style, NULL);
|
||||
if (toolbar_style == MIDORI_TOOLBAR_DEFAULT)
|
||||
{
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR(priv->navigationbar),
|
||||
config_to_toolbarstyle (config->toolbarStyle));
|
||||
g_object_get (priv->settings,
|
||||
"gtk-toolbar-style", >k_toolbar_style, NULL);
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (priv->navigationbar),
|
||||
gtk_toolbar_style);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,8 +887,9 @@ _action_navigationbar_activate (GtkToggleAction* action,
|
|||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
config->toolbarNavigation = gtk_toggle_action_get_active (action);
|
||||
sokoke_widget_set_visible (priv->navigationbar, config->toolbarNavigation);
|
||||
gboolean active = gtk_toggle_action_get_active (action);
|
||||
g_object_set (priv->settings, "show-navigationbar", active, NULL);
|
||||
sokoke_widget_set_visible (priv->navigationbar, active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -891,8 +898,9 @@ _action_bookmarkbar_activate (GtkToggleAction* action,
|
|||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
config->toolbarBookmarks = gtk_toggle_action_get_active (action);
|
||||
sokoke_widget_set_visible (priv->bookmarkbar, config->toolbarBookmarks);
|
||||
gboolean active = gtk_toggle_action_get_active (action);
|
||||
g_object_set (priv->settings, "show-bookmarkbar", active, NULL);
|
||||
sokoke_widget_set_visible (priv->bookmarkbar, active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -901,8 +909,9 @@ _action_statusbar_activate (GtkToggleAction* action,
|
|||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
config->toolbarStatus = gtk_toggle_action_get_active (action);
|
||||
sokoke_widget_set_visible (priv->statusbar, config->toolbarStatus);
|
||||
gboolean active = gtk_toggle_action_get_active (action);
|
||||
g_object_set (priv->settings, "show-statusbar", active, NULL);
|
||||
sokoke_widget_set_visible (priv->statusbar, active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -995,8 +1004,14 @@ static void
|
|||
_action_home_activate (GtkAction* action,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
gchar* homepage;
|
||||
|
||||
GtkWidget* web_view = midori_browser_get_current_web_view (browser);
|
||||
g_object_set (web_view, "uri", config->homepage, NULL);
|
||||
g_object_get (priv->settings, "homepage", &homepage, NULL);
|
||||
g_object_set (web_view, "uri", homepage, NULL);
|
||||
g_free (homepage);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1645,8 +1660,9 @@ _action_panel_activate (GtkToggleAction* action,
|
|||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
config->panelShow = gtk_toggle_action_get_active (action);
|
||||
sokoke_widget_set_visible (priv->panel, config->panelShow);
|
||||
gboolean active = gtk_toggle_action_get_active (action);
|
||||
g_object_set (priv->settings, "show-panel", active, NULL);
|
||||
sokoke_widget_set_visible (priv->panel, active);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1657,12 +1673,13 @@ _action_open_in_panel_activate (GtkAction* action,
|
|||
|
||||
GtkWidget* web_view = midori_browser_get_current_web_view (browser);
|
||||
const gchar* uri = midori_web_view_get_display_uri (MIDORI_WEB_VIEW (web_view));
|
||||
katze_assign (config->panelPageholder, g_strdup (uri));
|
||||
// FIXME: Don't assign the uri here, update it properly while navigating
|
||||
g_object_set (priv->settings, "last-pageholder-uri", uri, NULL);
|
||||
gint n = midori_panel_page_num (MIDORI_PANEL (priv->panel),
|
||||
priv->panel_pageholder);
|
||||
midori_panel_set_current_page (MIDORI_PANEL (priv->panel), n);
|
||||
gtk_widget_show (priv->panel);
|
||||
g_object_set (priv->panel_pageholder, "uri", config->panelPageholder, NULL);
|
||||
g_object_set (priv->panel_pageholder, "uri", uri, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1671,7 +1688,10 @@ midori_panel_notify_position_cb (GObject* object,
|
|||
GParamSpec* arg1,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
config->winPanelPos = gtk_paned_get_position (GTK_PANED (object));
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
gboolean position = gtk_paned_get_position (GTK_PANED (object));
|
||||
g_object_set (priv->settings, "last-panel-position", position, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -2087,6 +2107,7 @@ static void
|
|||
midori_browser_size_allocate_cb (MidoriBrowser* browser,
|
||||
GtkAllocation* allocation)
|
||||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
GtkWidget* widget = GTK_WIDGET (browser);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
|
@ -2094,8 +2115,9 @@ midori_browser_size_allocate_cb (MidoriBrowser* browser,
|
|||
GdkWindowState state = gdk_window_get_state (widget->window);
|
||||
if (!(state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)))
|
||||
{
|
||||
config->winWidth = allocation->width;
|
||||
config->winHeight = allocation->height;
|
||||
g_object_set (priv->settings,
|
||||
"last-window-width", allocation->width,
|
||||
"last-window-height", allocation->height, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2233,22 +2255,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
// Setup the window metrics
|
||||
g_signal_connect (browser, "window-state-event",
|
||||
G_CALLBACK (midori_browser_window_state_event_cb), NULL);
|
||||
GdkScreen* screen = gtk_window_get_screen (GTK_WINDOW (browser));
|
||||
const gint default_width = (gint)gdk_screen_get_width (screen) / 1.7;
|
||||
const gint default_height = (gint)gdk_screen_get_height (screen) / 1.7;
|
||||
if (config->rememberWinSize)
|
||||
{
|
||||
if (!config->winWidth && !config->winHeight)
|
||||
{
|
||||
config->winWidth = default_width;
|
||||
config->winHeight = default_width;
|
||||
}
|
||||
gtk_window_set_default_size (GTK_WINDOW (browser),
|
||||
config->winWidth, config->winHeight);
|
||||
}
|
||||
else
|
||||
gtk_window_set_default_size (GTK_WINDOW(browser),
|
||||
default_width, default_height);
|
||||
g_signal_connect (browser, "size-allocate",
|
||||
G_CALLBACK (midori_browser_size_allocate_cb), NULL);
|
||||
// FIXME: Use custom program icon
|
||||
|
@ -2338,14 +2344,11 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
// Create the navigationbar
|
||||
priv->navigationbar = gtk_ui_manager_get_widget (
|
||||
ui_manager, "/toolbar_navigation");
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (priv->navigationbar),
|
||||
config_to_toolbarstyle (config->toolbarStyle));
|
||||
GtkSettings* gtk_settings = gtk_widget_get_settings (priv->navigationbar);
|
||||
// FIXME: settings should be connected with screen changes
|
||||
GtkSettings* gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
|
||||
if (gtk_settings)
|
||||
g_signal_connect (gtk_settings, "notify::gtk-toolbar-style",
|
||||
G_CALLBACK (midori_browser_navigationbar_notify_style_cb),
|
||||
browser);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->navigationbar),
|
||||
config_to_toolbariconsize (config->toolbarSmall));
|
||||
G_CALLBACK (midori_browser_navigationbar_notify_style_cb), browser);
|
||||
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (priv->navigationbar), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->navigationbar, FALSE, FALSE, 0);
|
||||
priv->button_tab_new = gtk_ui_manager_get_widget (
|
||||
|
@ -2377,7 +2380,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
// FIXME: The interface is somewhat awkward and ought to be rethought
|
||||
// TODO: Display "show in context menu" search engines as "completion actions"
|
||||
entry_setup_completion (GTK_ENTRY (priv->search));
|
||||
update_searchEngine (config->searchEngine, priv->search);
|
||||
g_object_connect (priv->search,
|
||||
"signal::icon-released",
|
||||
on_webSearch_icon_released, browser,
|
||||
|
@ -2405,7 +2407,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
G_CALLBACK (_action_fullscreen_activate), browser);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->navigationbar),
|
||||
GTK_TOOL_ITEM (priv->button_fullscreen), -1);
|
||||
_action_set_active (browser, "Navigationbar", config->toolbarNavigation);
|
||||
|
||||
// Bookmarkbar
|
||||
priv->bookmarkbar = gtk_toolbar_new ();
|
||||
|
@ -2454,7 +2455,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
}
|
||||
sokoke_container_show_children (GTK_CONTAINER (priv->bookmarkbar));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->bookmarkbar, FALSE, FALSE, 0);
|
||||
_action_set_active (browser, "Bookmarkbar", config->toolbarBookmarks);
|
||||
|
||||
// Superuser warning
|
||||
GtkWidget* hbox;
|
||||
|
@ -2463,7 +2463,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
|
||||
// Create the panel
|
||||
GtkWidget* hpaned = gtk_hpaned_new ();
|
||||
gtk_paned_set_position (GTK_PANED (hpaned), config->winPanelPos);
|
||||
g_signal_connect (hpaned, "notify::position",
|
||||
G_CALLBACK (midori_panel_notify_position_cb),
|
||||
browser);
|
||||
|
@ -2476,8 +2475,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
g_signal_connect (priv->panel, "close",
|
||||
G_CALLBACK (midori_panel_close_cb), browser);
|
||||
gtk_paned_pack1 (GTK_PANED (hpaned), priv->panel, FALSE, FALSE);
|
||||
sokoke_widget_set_visible (priv->panel, config->panelShow);
|
||||
_action_set_active (browser, "Panel", config->panelShow);
|
||||
|
||||
// Bookmarks
|
||||
GtkWidget* box = gtk_vbox_new (FALSE, 0);
|
||||
|
@ -2552,17 +2549,13 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
|
||||
// Pageholder
|
||||
priv->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
|
||||
"uri", config->panelPageholder,
|
||||
"uri", "",
|
||||
NULL);
|
||||
gtk_widget_show (priv->panel_pageholder);
|
||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||
priv->panel_pageholder,
|
||||
GTK_STOCK_CONVERT, _("Pageholder"));
|
||||
|
||||
midori_panel_set_current_page (MIDORI_PANEL (priv->panel),
|
||||
config->panelActive);
|
||||
sokoke_widget_set_visible (priv->panel, config->panelShow);
|
||||
|
||||
// Notebook, containing all web_views
|
||||
priv->notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
|
||||
|
@ -2638,13 +2631,8 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
gtk_widget_set_size_request (priv->progressbar, -1, 1);
|
||||
gtk_box_pack_start (GTK_BOX (priv->statusbar), priv->progressbar,
|
||||
FALSE, FALSE, 3);
|
||||
_action_set_active (browser, "Statusbar", config->toolbarStatus);
|
||||
|
||||
g_object_unref (ui_manager);
|
||||
|
||||
sokoke_widget_set_visible (priv->button_tab_new, config->toolbarNewTab);
|
||||
sokoke_widget_set_visible (priv->search, config->toolbarWebSearch);
|
||||
sokoke_widget_set_visible (priv->button_trash, config->toolbarClosedTabs);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2668,6 +2656,99 @@ midori_browser_finalize (GObject* object)
|
|||
G_OBJECT_CLASS (midori_browser_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
_midori_browser_update_settings (MidoriBrowser* browser)
|
||||
{
|
||||
MidoriBrowserPrivate* priv = browser->priv;
|
||||
|
||||
gboolean remember_last_window_size;
|
||||
gint last_window_width, last_window_height;
|
||||
gint last_panel_position, last_panel_page;
|
||||
gboolean show_navigationbar, show_bookmarkbar, show_panel, show_statusbar;
|
||||
gboolean small_toolbar, show_new_tab, show_web_search, show_trash;
|
||||
MidoriToolbarStyle toolbar_style;
|
||||
gint last_web_search;
|
||||
gchar* last_pageholder_uri;
|
||||
g_object_get (priv->settings,
|
||||
"remember-last-window-size", &remember_last_window_size,
|
||||
"last-window-width", &last_window_width,
|
||||
"last-window-height", &last_window_height,
|
||||
"last-panel-position", &last_panel_position,
|
||||
"last-panel-page", &last_panel_page,
|
||||
"show-navigationbar", &show_navigationbar,
|
||||
"show-bookmarkbar", &show_bookmarkbar,
|
||||
"show-panel", &show_panel,
|
||||
"show-statusbar", &show_statusbar,
|
||||
"small-toolbar", &small_toolbar,
|
||||
"show-new-tab", &show_new_tab,
|
||||
"show-web-search", &show_web_search,
|
||||
"show-trash", &show_trash,
|
||||
"toolbar-style", &toolbar_style,
|
||||
"last-web-search", &last_web_search,
|
||||
"last-pageholder-uri", &last_pageholder_uri,
|
||||
NULL);
|
||||
|
||||
GdkScreen* screen = gtk_window_get_screen (GTK_WINDOW (browser));
|
||||
const gint default_width = (gint)gdk_screen_get_width (screen) / 1.7;
|
||||
const gint default_height = (gint)gdk_screen_get_height (screen) / 1.7;
|
||||
|
||||
if (remember_last_window_size)
|
||||
{
|
||||
if (last_window_width && last_window_height)
|
||||
gtk_window_set_default_size (GTK_WINDOW (browser),
|
||||
last_window_width, last_window_height);
|
||||
else
|
||||
gtk_window_set_default_size (GTK_WINDOW (browser),
|
||||
default_width, default_height);
|
||||
}
|
||||
|
||||
GtkToolbarStyle gtk_toolbar_style;
|
||||
GtkSettings* gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
|
||||
if (toolbar_style == MIDORI_TOOLBAR_DEFAULT && gtk_settings)
|
||||
g_object_get (gtk_settings, "gtk-toolbar-style", >k_toolbar_style, NULL);
|
||||
else
|
||||
{
|
||||
switch (toolbar_style)
|
||||
{
|
||||
case MIDORI_TOOLBAR_ICONS:
|
||||
gtk_toolbar_style = GTK_TOOLBAR_ICONS;
|
||||
break;
|
||||
case MIDORI_TOOLBAR_TEXT:
|
||||
gtk_toolbar_style = GTK_TOOLBAR_TEXT;
|
||||
break;
|
||||
case MIDORI_TOOLBAR_BOTH:
|
||||
gtk_toolbar_style = GTK_TOOLBAR_BOTH;
|
||||
break;
|
||||
case MIDORI_TOOLBAR_BOTH_HORIZ:
|
||||
case MIDORI_TOOLBAR_DEFAULT:
|
||||
gtk_toolbar_style = GTK_TOOLBAR_BOTH_HORIZ;
|
||||
}
|
||||
}
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (priv->navigationbar),
|
||||
gtk_toolbar_style);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->navigationbar),
|
||||
small_toolbar ? GTK_ICON_SIZE_SMALL_TOOLBAR
|
||||
: GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
|
||||
update_searchEngine (last_web_search, priv->search);
|
||||
|
||||
gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (priv->panel)),
|
||||
last_panel_position);
|
||||
midori_panel_set_current_page (MIDORI_PANEL (priv->panel), last_panel_page);
|
||||
g_object_set (priv->panel_pageholder, "uri", last_pageholder_uri, NULL);
|
||||
|
||||
_action_set_active (browser, "Navigationbar", show_navigationbar);
|
||||
_action_set_active (browser, "Bookmarkbar", show_bookmarkbar);
|
||||
_action_set_active (browser, "Panel", show_panel);
|
||||
_action_set_active (browser, "Statusbar", show_statusbar);
|
||||
|
||||
sokoke_widget_set_visible (priv->button_tab_new, show_new_tab);
|
||||
sokoke_widget_set_visible (priv->search, show_web_search);
|
||||
sokoke_widget_set_visible (priv->button_trash, show_trash);
|
||||
|
||||
g_free (last_pageholder_uri);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_browser_set_property (GObject* object,
|
||||
guint prop_id,
|
||||
|
@ -2685,6 +2766,7 @@ midori_browser_set_property (GObject* object,
|
|||
case PROP_SETTINGS:
|
||||
katze_object_assign (priv->settings, g_value_get_object (value));
|
||||
g_object_ref (priv->settings);
|
||||
_midori_browser_update_settings (browser);
|
||||
gtk_container_foreach (GTK_CONTAINER (priv->notebook),
|
||||
(GtkCallback) midori_web_view_set_settings,
|
||||
priv->settings);
|
||||
|
@ -2855,7 +2937,10 @@ midori_browser_append_tab (MidoriBrowser* browser,
|
|||
_midori_browser_update_actions (browser);
|
||||
|
||||
n = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), scrolled);
|
||||
if (!config->openTabsInTheBackground)
|
||||
gboolean open_tabs_in_the_background;
|
||||
g_object_get (priv->settings, "open-tabs-in-the-background",
|
||||
&open_tabs_in_the_background, NULL);
|
||||
if (open_tabs_in_the_background)
|
||||
{
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), n);
|
||||
gtk_window_set_focus (GTK_WINDOW (browser), priv->location);
|
||||
|
|
|
@ -20,12 +20,18 @@ G_DEFINE_TYPE (MidoriWebSettings, midori_web_settings, WEBKIT_TYPE_WEB_SETTINGS)
|
|||
|
||||
struct _MidoriWebSettingsPrivate
|
||||
{
|
||||
MidoriStartup load_on_startup;
|
||||
gchar* homepage;
|
||||
gchar* download_folder;
|
||||
gboolean show_download_notification;
|
||||
gchar* location_entry_search;
|
||||
MidoriPreferredEncoding preferred_encoding;
|
||||
gboolean remember_last_window_size;
|
||||
gint last_window_width;
|
||||
gint last_window_height;
|
||||
gint last_panel_position;
|
||||
gint last_panel_page;
|
||||
gint last_web_search;
|
||||
gchar* last_pageholder_uri;
|
||||
|
||||
gboolean show_navigationbar;
|
||||
gboolean show_bookmarkbar;
|
||||
gboolean show_panel;
|
||||
gboolean show_statusbar;
|
||||
|
||||
MidoriToolbarStyle toolbar_style;
|
||||
gboolean small_toolbar;
|
||||
|
@ -33,6 +39,13 @@ struct _MidoriWebSettingsPrivate
|
|||
gboolean show_new_tab;
|
||||
gboolean show_trash;
|
||||
|
||||
MidoriStartup load_on_startup;
|
||||
gchar* homepage;
|
||||
gchar* download_folder;
|
||||
gboolean show_download_notification;
|
||||
gchar* location_entry_search;
|
||||
MidoriPreferredEncoding preferred_encoding;
|
||||
|
||||
gint tab_label_size;
|
||||
gboolean close_buttons_on_tabs;
|
||||
MidoriNewPage open_new_pages_in;
|
||||
|
@ -61,12 +74,18 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_LOAD_ON_STARTUP,
|
||||
PROP_HOMEPAGE,
|
||||
PROP_DOWNLOAD_FOLDER,
|
||||
PROP_SHOW_DOWNLOAD_NOTIFICATION,
|
||||
PROP_LOCATION_ENTRY_SEARCH,
|
||||
PROP_PREFERRED_ENCODING,
|
||||
PROP_REMEMBER_LAST_WINDOW_SIZE,
|
||||
PROP_LAST_WINDOW_WIDTH,
|
||||
PROP_LAST_WINDOW_HEIGHT,
|
||||
PROP_LAST_PANEL_POSITION,
|
||||
PROP_LAST_PANEL_PAGE,
|
||||
PROP_LAST_WEB_SEARCH,
|
||||
PROP_LAST_PAGEHOLDER_URI,
|
||||
|
||||
PROP_SHOW_NAVIGATIONBAR,
|
||||
PROP_SHOW_BOOKMARKBAR,
|
||||
PROP_SHOW_PANEL,
|
||||
PROP_SHOW_STATUSBAR,
|
||||
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_SMALL_TOOLBAR,
|
||||
|
@ -74,6 +93,13 @@ enum
|
|||
PROP_SHOW_WEB_SEARCH,
|
||||
PROP_SHOW_TRASH,
|
||||
|
||||
PROP_LOAD_ON_STARTUP,
|
||||
PROP_HOMEPAGE,
|
||||
PROP_DOWNLOAD_FOLDER,
|
||||
PROP_SHOW_DOWNLOAD_NOTIFICATION,
|
||||
PROP_LOCATION_ENTRY_SEARCH,
|
||||
PROP_PREFERRED_ENCODING,
|
||||
|
||||
PROP_TAB_LABEL_SIZE,
|
||||
PROP_CLOSE_BUTTONS_ON_TABS,
|
||||
PROP_OPEN_NEW_PAGES_IN,
|
||||
|
@ -209,6 +235,156 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
|
||||
GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_REMEMBER_LAST_WINDOW_SIZE,
|
||||
g_param_spec_boolean (
|
||||
"remember-last-window-size",
|
||||
_("Remember last window size"),
|
||||
_("Whether to save the last window size"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_WINDOW_WIDTH,
|
||||
g_param_spec_int (
|
||||
"last-window-width",
|
||||
_("Last window width"),
|
||||
_("The last saved window width"),
|
||||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_WINDOW_HEIGHT,
|
||||
g_param_spec_int (
|
||||
"last-window-height",
|
||||
_("Last window height"),
|
||||
_("The last saved window height"),
|
||||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_PANEL_POSITION,
|
||||
g_param_spec_int (
|
||||
"last-panel-position",
|
||||
_("Last panel position"),
|
||||
_("The last saved panel position"),
|
||||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_PANEL_PAGE,
|
||||
g_param_spec_int (
|
||||
"last-panel-page",
|
||||
_("Last panel page"),
|
||||
_("The last saved panel page"),
|
||||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_WEB_SEARCH,
|
||||
g_param_spec_int (
|
||||
"last-web-search",
|
||||
_("Last Web search"),
|
||||
_("The last saved Web search"),
|
||||
0, G_MAXINT, 0,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAST_PAGEHOLDER_URI,
|
||||
g_param_spec_string (
|
||||
"last-pageholder-uri",
|
||||
_("Last pageholder URI"),
|
||||
_("The URI last opened in the pageholder"),
|
||||
"",
|
||||
flags));
|
||||
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_NAVIGATIONBAR,
|
||||
g_param_spec_boolean (
|
||||
"show-navigationbar",
|
||||
_("Show Navigationbar"),
|
||||
_("Whether to show the navigationbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_BOOKMARKBAR,
|
||||
g_param_spec_boolean (
|
||||
"show-bookmarkbar",
|
||||
_("Show Bookmarkbar"),
|
||||
_("Whether to show the bookmarkbar"),
|
||||
FALSE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_PANEL,
|
||||
g_param_spec_boolean (
|
||||
"show-panel",
|
||||
_("Show Panel"),
|
||||
_("Whether to show the panel"),
|
||||
FALSE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_STATUSBAR,
|
||||
g_param_spec_boolean (
|
||||
"show-statusbar",
|
||||
_("Show Statusbar"),
|
||||
_("Whether to show the statusbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TOOLBAR_STYLE,
|
||||
g_param_spec_enum (
|
||||
"toolbar-style",
|
||||
_("Toolbar Style"),
|
||||
_("The style of the toolbar"),
|
||||
MIDORI_TYPE_TOOLBAR_STYLE,
|
||||
MIDORI_TOOLBAR_DEFAULT,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SMALL_TOOLBAR,
|
||||
g_param_spec_boolean (
|
||||
"small-toolbar",
|
||||
_("Small toolbar"),
|
||||
_("Use small toolbar icons"),
|
||||
FALSE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_NEW_TAB,
|
||||
g_param_spec_boolean (
|
||||
"show-new-tab",
|
||||
_("Show New Tab"),
|
||||
_("Show the New Tab button in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_WEB_SEARCH,
|
||||
g_param_spec_boolean (
|
||||
"show-web-search",
|
||||
_("Show Web search"),
|
||||
_("Show the Web search entry in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_TRASH,
|
||||
g_param_spec_boolean (
|
||||
"show-trash",
|
||||
_("Show Trash"),
|
||||
_("Show the Trash button in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LOAD_ON_STARTUP,
|
||||
g_param_spec_enum (
|
||||
|
@ -267,54 +443,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TOOLBAR_STYLE,
|
||||
g_param_spec_enum (
|
||||
"toolbar-style",
|
||||
_("Toolbar Style"),
|
||||
_("The style of the toolbar"),
|
||||
MIDORI_TYPE_TOOLBAR_STYLE,
|
||||
MIDORI_TOOLBAR_DEFAULT,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SMALL_TOOLBAR,
|
||||
g_param_spec_boolean (
|
||||
"small-toolbar",
|
||||
_("Small toolbar"),
|
||||
_("Use small toolbar icons"),
|
||||
FALSE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_NEW_TAB,
|
||||
g_param_spec_boolean (
|
||||
"show-new-tab",
|
||||
_("Show New Tab"),
|
||||
_("Show the New Tab button in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_WEB_SEARCH,
|
||||
g_param_spec_boolean (
|
||||
"show-web-search",
|
||||
_("Show Web search"),
|
||||
_("Show the Web search entry in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_TRASH,
|
||||
g_param_spec_boolean (
|
||||
"show-trash",
|
||||
_("Show Trash"),
|
||||
_("Show the Trash button in the toolbar"),
|
||||
TRUE,
|
||||
flags));
|
||||
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TAB_LABEL_SIZE,
|
||||
g_param_spec_int (
|
||||
|
@ -511,6 +639,57 @@ midori_web_settings_set_property (GObject* object,
|
|||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_REMEMBER_LAST_WINDOW_SIZE:
|
||||
priv->remember_last_window_size = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_LAST_WINDOW_WIDTH:
|
||||
priv->last_window_width = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_WINDOW_HEIGHT:
|
||||
priv->last_window_height = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_PANEL_POSITION:
|
||||
priv->last_panel_position = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_PANEL_PAGE:
|
||||
priv->last_panel_page = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_WEB_SEARCH:
|
||||
priv->last_web_search = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_LAST_PAGEHOLDER_URI:
|
||||
katze_assign (priv->last_pageholder_uri, g_value_dup_string (value));
|
||||
break;
|
||||
|
||||
case PROP_SHOW_NAVIGATIONBAR:
|
||||
priv->show_navigationbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_BOOKMARKBAR:
|
||||
priv->show_bookmarkbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_PANEL:
|
||||
priv->show_panel = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_STATUSBAR:
|
||||
priv->show_statusbar = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_TOOLBAR_STYLE:
|
||||
priv->toolbar_style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_SMALL_TOOLBAR:
|
||||
priv->small_toolbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
priv->show_new_tab = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_WEB_SEARCH:
|
||||
priv->show_web_search = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_TRASH:
|
||||
priv->show_trash = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_LOAD_ON_STARTUP:
|
||||
priv->load_on_startup = g_value_get_enum (value);
|
||||
break;
|
||||
|
@ -550,22 +729,6 @@ midori_web_settings_set_property (GObject* object,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_TOOLBAR_STYLE:
|
||||
priv->toolbar_style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_SMALL_TOOLBAR:
|
||||
priv->small_toolbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
priv->show_new_tab = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_WEB_SEARCH:
|
||||
priv->show_web_search = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_TRASH:
|
||||
priv->show_trash = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_TAB_LABEL_SIZE:
|
||||
priv->tab_label_size = g_value_get_int (value);
|
||||
break;
|
||||
|
@ -632,6 +795,57 @@ midori_web_settings_get_property (GObject* object,
|
|||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_REMEMBER_LAST_WINDOW_SIZE:
|
||||
g_value_set_boolean (value, priv->remember_last_window_size);
|
||||
break;
|
||||
case PROP_LAST_WINDOW_WIDTH:
|
||||
g_value_set_int (value, priv->last_window_width);
|
||||
break;
|
||||
case PROP_LAST_WINDOW_HEIGHT:
|
||||
g_value_set_int (value, priv->last_window_height);
|
||||
break;
|
||||
case PROP_LAST_PANEL_POSITION:
|
||||
g_value_set_int (value, priv->last_panel_position);
|
||||
break;
|
||||
case PROP_LAST_PANEL_PAGE:
|
||||
g_value_set_int (value, priv->last_panel_page);
|
||||
break;
|
||||
case PROP_LAST_WEB_SEARCH:
|
||||
g_value_set_int (value, priv->last_web_search);
|
||||
break;
|
||||
case PROP_LAST_PAGEHOLDER_URI:
|
||||
g_value_set_string (value, priv->last_pageholder_uri);
|
||||
break;
|
||||
|
||||
case PROP_SHOW_NAVIGATIONBAR:
|
||||
g_value_set_boolean (value, priv->show_navigationbar);
|
||||
break;
|
||||
case PROP_SHOW_BOOKMARKBAR:
|
||||
g_value_set_boolean (value, priv->show_bookmarkbar);
|
||||
break;
|
||||
case PROP_SHOW_PANEL:
|
||||
g_value_set_boolean (value, priv->show_panel);
|
||||
break;
|
||||
case PROP_SHOW_STATUSBAR:
|
||||
g_value_set_boolean (value, priv->show_statusbar);
|
||||
break;
|
||||
|
||||
case PROP_TOOLBAR_STYLE:
|
||||
g_value_set_enum (value, priv->toolbar_style);
|
||||
break;
|
||||
case PROP_SMALL_TOOLBAR:
|
||||
g_value_set_boolean (value, priv->small_toolbar);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
g_value_set_boolean (value, priv->show_new_tab);
|
||||
break;
|
||||
case PROP_SHOW_WEB_SEARCH:
|
||||
g_value_set_boolean (value, priv->show_web_search);
|
||||
break;
|
||||
case PROP_SHOW_TRASH:
|
||||
g_value_set_boolean (value, priv->show_trash);
|
||||
break;
|
||||
|
||||
case PROP_LOAD_ON_STARTUP:
|
||||
g_value_set_enum (value, priv->load_on_startup);
|
||||
break;
|
||||
|
@ -651,22 +865,6 @@ midori_web_settings_get_property (GObject* object,
|
|||
g_value_set_enum (value, priv->preferred_encoding);
|
||||
break;
|
||||
|
||||
case PROP_TOOLBAR_STYLE:
|
||||
g_value_set_enum (value, priv->toolbar_style);
|
||||
break;
|
||||
case PROP_SMALL_TOOLBAR:
|
||||
g_value_set_boolean (value, priv->small_toolbar);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
g_value_set_boolean (value, priv->show_new_tab);
|
||||
break;
|
||||
case PROP_SHOW_WEB_SEARCH:
|
||||
g_value_set_boolean (value, priv->show_web_search);
|
||||
break;
|
||||
case PROP_SHOW_TRASH:
|
||||
g_value_set_boolean (value, priv->show_trash);
|
||||
break;
|
||||
|
||||
case PROP_TAB_LABEL_SIZE:
|
||||
g_value_set_int (value, priv->tab_label_size);
|
||||
break;
|
||||
|
|
|
@ -41,7 +41,7 @@ void update_searchEngine(guint index, GtkWidget* search)
|
|||
g_object_unref(pixbuf);
|
||||
sokoke_entry_set_default_text(GTK_ENTRY(search)
|
||||
, search_engine_get_short_name(engine));
|
||||
config->searchEngine = index;
|
||||
// config->searchEngine = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,11 +427,11 @@ void on_webSearch_activate(GtkWidget* widget, MidoriBrowser* browser)
|
|||
{
|
||||
const gchar* keywords = gtk_entry_get_text(GTK_ENTRY(widget));
|
||||
gchar* url;
|
||||
SearchEngine* searchEngine = (SearchEngine*)g_list_nth_data(searchEngines, config->searchEngine);
|
||||
SearchEngine* searchEngine = (SearchEngine*)g_list_nth_data(searchEngines, 0/*config->searchEngine*/);
|
||||
if(searchEngine)
|
||||
url = searchEngine->url;
|
||||
else // The location search is our fallback
|
||||
url = config->locationSearch;
|
||||
url = "";//config->locationSearch;
|
||||
gchar* search;
|
||||
if(strstr(url, "%s"))
|
||||
search = g_strdup_printf(url, keywords);
|
||||
|
|
Loading…
Reference in a new issue