Move transfers, console and addons out of the browser

This commit is contained in:
Christian Dywan 2008-11-20 03:49:57 +01:00
parent ab747a427f
commit fdb12aa537
3 changed files with 81 additions and 62 deletions

View file

@ -14,12 +14,16 @@
#include <config.h>
#endif
#include "midori-view.h"
#include "midori-addons.h"
#include "midori-app.h"
#include "midori-websettings.h"
#include "midori-browser.h"
#include "midori-stock.h"
#include "midori-console.h"
#include "midori-extension.h"
#include "midori-panel.h"
#include "midori-stock.h"
#include "midori-view.h"
#include "midori-websettings.h"
#include "sokoke.h"
#include "gjs.h"
@ -974,6 +978,76 @@ katze_array_to_file (KatzeArray* array,
return TRUE;
}
static void
midori_view_console_message_cb (GtkWidget* view,
const gchar* message,
gint line,
const gchar* source_id,
MidoriConsole* console)
{
midori_console_add (console, message, line, source_id);
}
static void
midori_browser_add_tab_cb (MidoriBrowser* browser,
MidoriView* view,
MidoriConsole* console)
{
g_signal_connect (view, "console-message",
G_CALLBACK (midori_view_console_message_cb), console);
}
static void
midori_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
KatzeNet* net)
{
GtkWidget* panel;
GtkWidget* addon;
GtkWidget* toolbar;
panel = katze_object_get_object (browser, "panel");
/* Transfers */
/* addon = midori_view_new (net);
gtk_widget_show (addon);
midori_panel_append_page (MIDORI_PANEL (panel), addon, NULL,
STOCK_TRANSFERS, _("Transfers")); */
/* Console */
addon = midori_console_new ();
gtk_widget_show (addon);
toolbar = midori_console_get_toolbar (MIDORI_CONSOLE (addon));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (panel), addon, toolbar,
STOCK_CONSOLE, _("Console"));
g_signal_connect (browser, "add-tab",
G_CALLBACK (midori_browser_add_tab_cb), addon);
/* Userscripts */
addon = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
gtk_widget_show (addon);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (addon));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (panel), addon, toolbar,
STOCK_SCRIPTS, _("Userscripts"));
/* Userstyles */
addon = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_STYLES);
gtk_widget_show (addon);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (addon));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (panel), addon, toolbar,
STOCK_STYLES, _("Userstyles"));
/* Extensions */
addon = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
gtk_widget_show (addon);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (addon));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (panel), addon, toolbar,
STOCK_EXTENSIONS, _("Extensions"));
}
static void
midori_browser_session_cb (MidoriBrowser* browser,
gpointer arg1,
@ -1341,6 +1415,8 @@ main (int argc,
"history", history,
"extensions", extensions,
NULL);
g_signal_connect (app, "add-browser",
G_CALLBACK (midori_app_add_browser_cb), NULL);
n = katze_array_get_length (extensions);
for (i = 0; i < n; i++)

View file

@ -965,6 +965,8 @@ midori_addons_set_web_widget (MidoriAddons* addons,
GtkWidget*
midori_addons_get_web_widget (MidoriAddons* addons)
{
g_return_val_if_fail (MIDORI_IS_ADDONS (addons), NULL);
return addons->web_widget;
}

View file

@ -20,8 +20,6 @@
#include "midori-source.h"
#include "midori-preferences.h"
#include "midori-panel.h"
#include "midori-addons.h"
#include "midori-console.h"
#include "midori-locationaction.h"
#include "midori-searchaction.h"
#include "midori-stock.h"
@ -54,7 +52,6 @@ struct _MidoriBrowser
GtkWidget* panel;
GtkWidget* panel_bookmarks;
GtkWidget* panel_history;
GtkWidget* panel_console;
GtkWidget* panel_pageholder;
GtkWidget* notebook;
@ -753,17 +750,6 @@ midori_view_activate_action_cb (GtkWidget* view,
_midori_browser_activate_action (browser, action);
}
static void
midori_view_console_message_cb (GtkWidget* view,
const gchar* message,
gint line,
const gchar* source_id,
MidoriBrowser* browser)
{
midori_console_add (MIDORI_CONSOLE (browser->panel_console),
message, line, source_id);
}
static void
midori_view_attach_inspector_cb (GtkWidget* view,
GtkWidget* inspector_view,
@ -892,8 +878,6 @@ _midori_browser_add_tab (MidoriBrowser* browser,
midori_view_notify_statusbar_text_cb, browser,
"signal::activate-action",
midori_view_activate_action_cb, browser,
"signal::console-message",
midori_view_console_message_cb, browser,
"signal::attach-inspector",
midori_view_attach_inspector_cb, browser,
"signal::new-tab",
@ -3660,7 +3644,6 @@ midori_browser_init (MidoriBrowser* browser)
GtkWidget* treeview;
GtkWidget* toolbar;
GtkToolItem* toolitem;
GtkWidget* panel;
GtkRcStyle* rcstyle;
GtkWidget* scrolled;
@ -3935,22 +3918,6 @@ midori_browser_init (MidoriBrowser* browser)
box, toolbar,
STOCK_BOOKMARKS, _("Bookmarks"));
/* Transfers */
panel = midori_view_new (browser->net);
gtk_widget_show (panel);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, NULL,
STOCK_TRANSFERS, _("Transfers"));
/* Console */
browser->panel_console = midori_console_new ();
gtk_widget_show (browser->panel_console);
toolbar = midori_console_get_toolbar (MIDORI_CONSOLE (browser->panel_console));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
browser->panel_console, toolbar,
STOCK_CONSOLE, _("Console"));
/* History */
box = gtk_vbox_new (FALSE, 0);
treestore = gtk_tree_store_new (2, KATZE_TYPE_ITEM, G_TYPE_INT);
@ -4005,32 +3972,6 @@ midori_browser_init (MidoriBrowser* browser)
/* i18n: A panel showing a user specified web page */
STOCK_PAGE_HOLDER, _("Pageholder"));
/* Userscripts */
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
gtk_widget_show (panel);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (panel));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
STOCK_SCRIPTS, _("Userscripts"));
/* Userstyles */
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_STYLES);
gtk_widget_show (panel);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (panel));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
STOCK_STYLES, _("Userstyles"));
/* Extensions */
panel = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
gtk_widget_show (panel);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (panel));
gtk_widget_show (toolbar);
midori_panel_append_page (MIDORI_PANEL (browser->panel),
panel, toolbar,
STOCK_EXTENSIONS, _("Extensions"));
/* Notebook, containing all views */
vpaned = gtk_vpaned_new ();
gtk_paned_pack2 (GTK_PANED (hpaned), vpaned, FALSE, FALSE);