Implement tabs in individual processes
The approach is rather plump, Midori can be run in a plug mode that creates a GtkPlug, while the normal instance knows how to embed it. Communication between browser and tabs is done via named pipes which are portable. The feature is not complete right now, there are expected regressions, but it works. As a bonus, we implement Not found pages.
This commit is contained in:
parent
45f32f3f77
commit
62838fdf58
13 changed files with 3406 additions and 2216 deletions
|
@ -28,7 +28,8 @@ midori_SOURCES = \
|
|||
midori-panel.c midori-panel.h \
|
||||
midori-addons.c midori-addons.h \
|
||||
midori-console.c midori-console.h \
|
||||
midori-webview.c midori-webview.h \
|
||||
midori-view.c midori-view.h \
|
||||
midori-source.c midori-source.h \
|
||||
midori-websettings.c midori-websettings.h \
|
||||
midori-preferences.c midori-preferences.h \
|
||||
midori-searchentry.c midori-searchentry.h \
|
||||
|
|
103
midori/main.c
103
midori/main.c
|
@ -13,6 +13,7 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "midori-view.h"
|
||||
#include "midori-app.h"
|
||||
#include "midori-websettings.h"
|
||||
#include "midori-browser.h"
|
||||
|
@ -367,25 +368,76 @@ _simple_xml_element (const gchar* name,
|
|||
}
|
||||
|
||||
static gchar*
|
||||
katze_xbel_array_to_xml (KatzeArray* array,
|
||||
katze_item_to_data (KatzeItem* item)
|
||||
{
|
||||
gchar* markup;
|
||||
|
||||
g_return_val_if_fail (KATZE_IS_ITEM (item), NULL);
|
||||
|
||||
markup = NULL;
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
{
|
||||
GString* _markup = g_string_new (NULL);
|
||||
guint n = katze_array_get_length (KATZE_ARRAY (item));
|
||||
guint i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
KatzeItem* _item = katze_array_get_nth_item (KATZE_ARRAY (item), i);
|
||||
gchar* item_markup = katze_item_to_data (_item);
|
||||
g_string_append (_markup, item_markup);
|
||||
g_free (item_markup);
|
||||
}
|
||||
/* gchar* folded = item->folded ? NULL : g_strdup_printf (" folded=\"no\""); */
|
||||
gchar* title = _simple_xml_element ("title", katze_item_get_name (item));
|
||||
gchar* desc = _simple_xml_element ("desc", katze_item_get_text (item));
|
||||
markup = g_strdup_printf ("<folder%s>\n%s%s%s</folder>\n",
|
||||
"" /* folded ? folded : "" */,
|
||||
title, desc,
|
||||
g_string_free (_markup, FALSE));
|
||||
/* g_free (folded); */
|
||||
g_free (title);
|
||||
g_free (desc);
|
||||
}
|
||||
else if (katze_item_get_uri (item))
|
||||
{
|
||||
gchar* href_escaped = g_markup_escape_text (katze_item_get_uri (item), -1);
|
||||
gchar* href = g_strdup_printf (" href=\"%s\"", href_escaped);
|
||||
g_free (href_escaped);
|
||||
gchar* title = _simple_xml_element ("title", katze_item_get_name (item));
|
||||
gchar* desc = _simple_xml_element ("desc", katze_item_get_text (item));
|
||||
markup = g_strdup_printf ("<bookmark%s>\n%s%s%s</bookmark>\n",
|
||||
href,
|
||||
title, desc,
|
||||
"");
|
||||
g_free (href);
|
||||
g_free (title);
|
||||
g_free (desc);
|
||||
}
|
||||
else
|
||||
markup = g_strdup ("<separator/>\n");
|
||||
return markup;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
katze_array_to_xml (KatzeArray* array,
|
||||
GError** error)
|
||||
{
|
||||
GString* inner_markup;
|
||||
guint i, n;
|
||||
KatzeXbelItem* item;
|
||||
KatzeItem* item;
|
||||
gchar* item_xml;
|
||||
gchar* title;
|
||||
gchar* desc;
|
||||
gchar* outer_markup;
|
||||
|
||||
g_return_val_if_fail (katze_array_is_a (array, KATZE_TYPE_XBEL_ITEM), NULL);
|
||||
g_return_val_if_fail (katze_array_is_a (array, KATZE_TYPE_ITEM), NULL);
|
||||
|
||||
inner_markup = g_string_new (NULL);
|
||||
n = katze_array_get_length (array);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
item = katze_array_get_nth_item (array, i);
|
||||
item_xml = katze_xbel_item_to_data (item);
|
||||
item_xml = katze_item_to_data (item);
|
||||
g_string_append (inner_markup, item_xml);
|
||||
g_free (item_xml);
|
||||
}
|
||||
|
@ -415,10 +467,10 @@ katze_array_to_file (KatzeArray* array,
|
|||
gchar* data;
|
||||
FILE* fp;
|
||||
|
||||
g_return_val_if_fail (katze_array_is_a (array, KATZE_TYPE_XBEL_ITEM), FALSE);
|
||||
g_return_val_if_fail (katze_array_is_a (array, KATZE_TYPE_ITEM), FALSE);
|
||||
g_return_val_if_fail (filename, FALSE);
|
||||
|
||||
if (!(data = katze_xbel_array_to_xml (array, error)))
|
||||
if (!(data = katze_array_to_xml (array, error)))
|
||||
return FALSE;
|
||||
if (!(fp = fopen (filename, "w")))
|
||||
{
|
||||
|
@ -468,6 +520,7 @@ int
|
|||
main (int argc,
|
||||
char** argv)
|
||||
{
|
||||
guint socket_id;
|
||||
gboolean version;
|
||||
gchar** uris;
|
||||
MidoriApp* app;
|
||||
|
@ -475,12 +528,16 @@ main (int argc,
|
|||
GError* error;
|
||||
GOptionEntry entries[] =
|
||||
{
|
||||
{ "id", 'i', 0, G_OPTION_ARG_INT, &socket_id,
|
||||
N_("Internal identifier"), NULL },
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version,
|
||||
N_("Display program version"), NULL },
|
||||
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &uris,
|
||||
N_("URIs"), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
GtkWidget* view;
|
||||
GtkWidget* plug;
|
||||
MidoriStartup load_on_startup;
|
||||
gchar* homepage;
|
||||
KatzeArray* search_engines;
|
||||
|
@ -498,6 +555,7 @@ main (int argc,
|
|||
g_set_application_name (_("Midori"));
|
||||
|
||||
/* Parse cli options */
|
||||
socket_id = 0;
|
||||
version = FALSE;
|
||||
uris = NULL;
|
||||
error = NULL;
|
||||
|
@ -509,6 +567,22 @@ main (int argc,
|
|||
return 1;
|
||||
}
|
||||
|
||||
stock_items_init ();
|
||||
|
||||
if (socket_id)
|
||||
{
|
||||
/* If an ID was specified we create a view in a plug.
|
||||
This allows us to open views in separate processes. */
|
||||
view = g_object_new (MIDORI_TYPE_VIEW, "socket-id", socket_id, NULL);
|
||||
gtk_widget_show (view);
|
||||
plug = gtk_plug_new (socket_id);
|
||||
gtk_container_add (GTK_CONTAINER (plug), view);
|
||||
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
|
||||
gtk_widget_show (plug);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (version)
|
||||
{
|
||||
g_print (
|
||||
|
@ -539,6 +613,8 @@ main (int argc,
|
|||
return 1;
|
||||
}
|
||||
|
||||
sokoke_remember_argv0 (argv[0]);
|
||||
|
||||
app = midori_app_new ();
|
||||
if (midori_app_instance_is_running (app))
|
||||
{
|
||||
|
@ -691,15 +767,20 @@ main (int argc,
|
|||
}
|
||||
g_free (config_path);
|
||||
|
||||
stock_items_init ();
|
||||
|
||||
KatzeArray* trash = katze_array_new (KATZE_TYPE_XBEL_ITEM);
|
||||
KatzeArray* trash = katze_array_new (KATZE_TYPE_ITEM);
|
||||
guint n = katze_xbel_folder_get_n_items (xbel_trash);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
KatzeXbelItem* item = katze_xbel_folder_get_nth_item (xbel_trash, i);
|
||||
KatzeXbelItem* xbel_item = katze_xbel_folder_get_nth_item (xbel_trash, i);
|
||||
if (!katze_xbel_item_is_separator (xbel_item))
|
||||
{
|
||||
KatzeItem* item = g_object_new (KATZE_TYPE_ITEM,
|
||||
"name", katze_xbel_item_get_title (xbel_item),
|
||||
"uri", katze_xbel_bookmark_get_href (xbel_item),
|
||||
NULL);
|
||||
katze_array_add_item (trash, item);
|
||||
}
|
||||
}
|
||||
katze_xbel_item_unref (xbel_trash);
|
||||
g_signal_connect_after (trash, "add-item",
|
||||
G_CALLBACK (midori_web_list_add_item_cb), NULL);
|
||||
|
@ -719,7 +800,7 @@ main (int argc,
|
|||
midori_app_add_browser (app, browser);
|
||||
gtk_widget_show (GTK_WIDGET (browser));
|
||||
|
||||
KatzeArray* session = midori_browser_get_proxy_xbel_array (browser);
|
||||
KatzeArray* session = midori_browser_get_proxy_array (browser);
|
||||
n = katze_xbel_folder_get_n_items (_session);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,10 +56,10 @@ struct _MidoriBrowserClass
|
|||
|
||||
void
|
||||
(*add_tab) (MidoriBrowser* browser,
|
||||
GtkWidget* widget);
|
||||
GtkWidget* view);
|
||||
void
|
||||
(*remove_tab) (MidoriBrowser* browser,
|
||||
GtkWidget* widget);
|
||||
GtkWidget* view);
|
||||
void
|
||||
(*activate_action) (MidoriBrowser* browser,
|
||||
const gchar* name);
|
||||
|
@ -85,6 +85,10 @@ gint
|
|||
midori_browser_add_xbel_item (MidoriBrowser* browser,
|
||||
KatzeXbelItem* xbel_item);
|
||||
|
||||
gint
|
||||
midori_browser_add_item (MidoriBrowser* browser,
|
||||
KatzeItem* item);
|
||||
|
||||
gint
|
||||
midori_browser_add_uri (MidoriBrowser* browser,
|
||||
const gchar* uri);
|
||||
|
@ -110,11 +114,8 @@ midori_browser_set_current_tab (MidoriBrowser* browser,
|
|||
GtkWidget*
|
||||
midori_browser_get_current_tab (MidoriBrowser* browser);
|
||||
|
||||
GtkWidget*
|
||||
midori_browser_get_current_web_view (MidoriBrowser* browser);
|
||||
|
||||
KatzeArray*
|
||||
midori_browser_get_proxy_xbel_array (MidoriBrowser* browser);
|
||||
midori_browser_get_proxy_array (MidoriBrowser* browser);
|
||||
|
||||
void
|
||||
midori_browser_quit (MidoriBrowser* browser);
|
||||
|
|
|
@ -373,6 +373,10 @@ midori_panel_append_page (MidoriPanel* panel,
|
|||
g_return_val_if_fail (stock_id != NULL, -1);
|
||||
g_return_val_if_fail (label != NULL, -1);
|
||||
|
||||
if (GTK_IS_SCROLLED_WINDOW (child))
|
||||
scrolled = child;
|
||||
else
|
||||
{
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
|
@ -389,6 +393,7 @@ midori_panel_append_page (MidoriPanel* panel,
|
|||
gtk_container_add (GTK_CONTAINER (widget), child);
|
||||
}
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), widget);
|
||||
}
|
||||
gtk_container_add (GTK_CONTAINER (panel->notebook), scrolled);
|
||||
|
||||
if (!toolbar)
|
||||
|
|
191
midori/midori-source.c
Normal file
191
midori/midori-source.c
Normal file
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "midori-source.h"
|
||||
|
||||
#include <string.h>
|
||||
#if HAVE_GIO
|
||||
#include <gio/gio.h>
|
||||
#endif
|
||||
#include <glib/gi18n.h>
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
#include <gtksourceview/gtksourceview.h>
|
||||
#include <gtksourceview/gtksourcelanguagemanager.h>
|
||||
|
||||
#define MidoriSourceView GtkSourceView
|
||||
#define MidoriSourceViewClass GtkSourceViewClass
|
||||
#define MIDORI_TYPE_SOURCE_VIEW GTK_TYPE_SOURCE_VIEW
|
||||
#else
|
||||
#define MidoriSourceView GtkTextView
|
||||
#define MidoriSourceViewClass GtkTextViewClass
|
||||
#define MIDORI_TYPE_SOURCE_VIEW GTK_TYPE_TEXT_VIEW
|
||||
#endif
|
||||
|
||||
struct _MidoriSource
|
||||
{
|
||||
MidoriSourceView parent_instance;
|
||||
};
|
||||
|
||||
struct _MidoriSourceClass
|
||||
{
|
||||
MidoriSourceViewClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MidoriSource, midori_source, MIDORI_TYPE_SOURCE_VIEW);
|
||||
|
||||
static void
|
||||
midori_source_finalize (GObject* object);
|
||||
|
||||
static void
|
||||
midori_source_class_init (MidoriSourceClass* class)
|
||||
{
|
||||
GObjectClass* gobject_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
gobject_class->finalize = midori_source_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
midori_source_init (MidoriSource* source)
|
||||
{
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
GtkSourceBuffer* buffer;
|
||||
#else
|
||||
GtkTextBuffer* buffer;
|
||||
#endif
|
||||
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
buffer = gtk_source_buffer_new (NULL);
|
||||
gtk_source_buffer_set_highlight_syntax (buffer, TRUE);
|
||||
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (source), TRUE);
|
||||
#else
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
#endif
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source), GTK_TEXT_BUFFER (buffer));
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (source), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_source_finalize (GObject* object)
|
||||
{
|
||||
G_OBJECT_CLASS (midori_source_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_source_new:
|
||||
* @uri: a view-source: URI
|
||||
*
|
||||
* Creates a new source widget.
|
||||
*
|
||||
* Return value: a new #MidoriSource
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_source_new (const gchar* uri)
|
||||
{
|
||||
MidoriSource* source = g_object_new (MIDORI_TYPE_SOURCE,
|
||||
/*"uri", uri,*/
|
||||
NULL);
|
||||
midori_source_set_uri (source, uri);
|
||||
|
||||
return GTK_WIDGET (source);
|
||||
}
|
||||
|
||||
void
|
||||
midori_source_set_uri (MidoriSource* source,
|
||||
const gchar* uri)
|
||||
{
|
||||
#if HAVE_GIO
|
||||
GFile* file;
|
||||
gchar* tag;
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
GFileInfo* info;
|
||||
const gchar* content_type;
|
||||
#endif
|
||||
#endif
|
||||
gchar* contents;
|
||||
gchar* contents_utf8;
|
||||
GtkTextBuffer* buffer;
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
#if HAVE_GIO
|
||||
GtkSourceLanguageManager* language_manager;
|
||||
GtkSourceLanguage* language;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_return_if_fail (MIDORI_IS_SOURCE (source));
|
||||
|
||||
contents = NULL;
|
||||
|
||||
#if HAVE_GIO
|
||||
file = g_file_new_for_uri (uri);
|
||||
tag = NULL;
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
content_type = NULL;
|
||||
#endif
|
||||
if (g_file_load_contents (file, NULL, &contents, NULL, &tag, NULL))
|
||||
{
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
|
||||
G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
||||
content_type = g_file_info_get_content_type (info);
|
||||
#endif
|
||||
g_object_unref (file);
|
||||
}
|
||||
if (contents && !g_utf8_validate (contents, -1, NULL))
|
||||
{
|
||||
contents_utf8 = g_convert (contents, -1, "UTF-8", "ISO-8859-1",
|
||||
NULL, NULL, NULL);
|
||||
g_free (contents);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
contents_utf8 = contents;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (source));
|
||||
#if HAVE_GTKSOURCEVIEW
|
||||
#if HAVE_GIO
|
||||
if (content_type)
|
||||
{
|
||||
language_manager = gtk_source_language_manager_get_default ();
|
||||
if (!strcmp (content_type, "text/html"))
|
||||
{
|
||||
language = gtk_source_language_manager_get_language (
|
||||
language_manager, "html");
|
||||
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (buffer), language);
|
||||
}
|
||||
else if (!strcmp (content_type, "text/css"))
|
||||
{
|
||||
language = gtk_source_language_manager_get_language (
|
||||
language_manager, "css");
|
||||
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (buffer), language);
|
||||
}
|
||||
else if (!strcmp (content_type, "text/javascript"))
|
||||
{
|
||||
language = gtk_source_language_manager_get_language (
|
||||
language_manager, "js");
|
||||
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (buffer), language);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (contents_utf8)
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), contents_utf8, -1);
|
||||
|
||||
g_object_unref (buffer);
|
||||
g_free (contents_utf8);
|
||||
#if HAVE_GIO
|
||||
g_free (tag);
|
||||
#endif
|
||||
}
|
47
midori/midori-source.h
Normal file
47
midori/midori-source.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright (C) 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 __MIDORI_SOURCE_H__
|
||||
#define __MIDORI_SOURCE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MIDORI_TYPE_SOURCE \
|
||||
(midori_source_get_type ())
|
||||
#define MIDORI_SOURCE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_SOURCE, MidoriSource))
|
||||
#define MIDORI_SOURCE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_SOURCE, MidoriSourceClass))
|
||||
#define MIDORI_IS_SOURCE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_SOURCE))
|
||||
#define MIDORI_IS_SOURCE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_SOURCE))
|
||||
#define MIDORI_SOURCE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_SOURCE, MidoriSourceClass))
|
||||
|
||||
typedef struct _MidoriSource MidoriSource;
|
||||
typedef struct _MidoriSourceClass MidoriSourceClass;
|
||||
|
||||
GType
|
||||
midori_source_get_type (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_source_new (const gchar* uri);
|
||||
|
||||
void
|
||||
midori_source_set_uri (MidoriSource* source,
|
||||
const gchar* uri);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MIDORI_SOURCE_H__ */
|
2451
midori/midori-view.c
Normal file
2451
midori/midori-view.c
Normal file
File diff suppressed because it is too large
Load diff
161
midori/midori-view.h
Normal file
161
midori/midori-view.h
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
Copyright (C) 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 __MIDORI_VIEW_H__
|
||||
#define __MIDORI_VIEW_H__
|
||||
|
||||
#include "midori-websettings.h"
|
||||
|
||||
#include <katze/katze.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MIDORI_LOAD_PROVISIONAL,
|
||||
MIDORI_LOAD_COMMITTED,
|
||||
MIDORI_LOAD_FINISHED
|
||||
} MidoriLoadStatus;
|
||||
|
||||
GType
|
||||
midori_load_status_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define MIDORI_TYPE_LOAD_STATUS \
|
||||
(midori_load_status_get_type ())
|
||||
|
||||
#define MIDORI_TYPE_VIEW \
|
||||
(midori_view_get_type ())
|
||||
#define MIDORI_VIEW(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_VIEW, MidoriView))
|
||||
#define MIDORI_VIEW_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_VIEW, MidoriViewClass))
|
||||
#define MIDORI_IS_VIEW(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_VIEW))
|
||||
#define MIDORI_IS_VIEW_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_VIEW))
|
||||
#define MIDORI_VIEW_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_VIEW, MidoriViewClass))
|
||||
|
||||
typedef struct _MidoriView MidoriView;
|
||||
typedef struct _MidoriViewClass MidoriViewClass;
|
||||
|
||||
GType
|
||||
midori_view_get_type (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_new (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_new_with_uri (const gchar* uri);
|
||||
|
||||
void
|
||||
midori_view_set_settings (MidoriView* view,
|
||||
MidoriWebSettings* settings);
|
||||
|
||||
gdouble
|
||||
midori_view_get_progress (MidoriView* view);
|
||||
|
||||
MidoriLoadStatus
|
||||
midori_view_get_load_status (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_set_uri (MidoriView* view,
|
||||
const gchar* uri);
|
||||
|
||||
gboolean
|
||||
midori_view_is_blank (MidoriView* view);
|
||||
|
||||
const gchar*
|
||||
midori_view_get_display_uri (MidoriView* view);
|
||||
|
||||
const gchar*
|
||||
midori_view_get_display_title (MidoriView* view);
|
||||
|
||||
GdkPixbuf*
|
||||
midori_view_get_icon (MidoriView* view);
|
||||
|
||||
const gchar*
|
||||
midori_view_get_link_uri (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_has_selection (MidoriView* view);
|
||||
|
||||
const gchar*
|
||||
midori_view_get_selected_text (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_cut_clipboard (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_copy_clipboard (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_paste_clipboard (MidoriView* view);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_get_proxy_menu_item (MidoriView* view);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_get_proxy_tab_label (MidoriView* view);
|
||||
|
||||
KatzeItem*
|
||||
midori_view_get_proxy_item (MidoriView* view);
|
||||
|
||||
gfloat
|
||||
midori_view_get_zoom_level (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_zoom_in (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_zoom_out (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_set_zoom_level (MidoriView* view,
|
||||
gfloat zoom_level);
|
||||
|
||||
gboolean
|
||||
midori_view_can_reload (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_reload (MidoriView* view,
|
||||
gboolean from_cache);
|
||||
|
||||
void
|
||||
midori_view_stop_loading (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_go_back (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_go_back (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_go_forward (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_go_forward (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_print (MidoriView* view);
|
||||
|
||||
void
|
||||
midori_view_print (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_view_source (MidoriView* view);
|
||||
|
||||
gboolean
|
||||
midori_view_can_find (MidoriView* view);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MIDORI_VIEW_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 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 __MIDORI_WEB_VIEW_H__
|
||||
#define __MIDORI_WEB_VIEW_H__
|
||||
|
||||
#include "midori-websettings.h"
|
||||
|
||||
#include <katze/katze.h>
|
||||
#include <webkit/webkit.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MIDORI_TYPE_WEB_VIEW \
|
||||
(midori_web_view_get_type ())
|
||||
#define MIDORI_WEB_VIEW(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_WEB_VIEW, MidoriWebView))
|
||||
#define MIDORI_WEB_VIEW_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_WEB_VIEW, MidoriWebViewClass))
|
||||
#define MIDORI_IS_WEB_VIEW(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_WEB_VIEW))
|
||||
#define MIDORI_IS_WEB_VIEW_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_WEB_VIEW))
|
||||
#define MIDORI_WEB_VIEW_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_WEB_VIEW, MidoriWebViewClass))
|
||||
|
||||
typedef struct _MidoriWebView MidoriWebView;
|
||||
typedef struct _MidoriWebViewClass MidoriWebViewClass;
|
||||
|
||||
struct _MidoriWebViewClass
|
||||
{
|
||||
WebKitWebViewClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void
|
||||
(*icon_ready) (MidoriWebView* web_view,
|
||||
GdkPixbuf* icon);
|
||||
void
|
||||
(*news_feed_ready) (MidoriWebView* web_view,
|
||||
const gchar* href,
|
||||
const gchar* type,
|
||||
const gchar* title);
|
||||
void
|
||||
(*load_done) (MidoriWebView* web_view,
|
||||
WebKitWebFrame* frame);
|
||||
void
|
||||
(*element_motion) (MidoriWebView* web_view,
|
||||
const gchar* link_uri);
|
||||
void
|
||||
(*close) (MidoriWebView* web_view);
|
||||
void
|
||||
(*new_tab) (MidoriWebView* web_view,
|
||||
const gchar* uri);
|
||||
void
|
||||
(*new_window) (MidoriWebView* web_view,
|
||||
const gchar* uri);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MIDORI_LOAD_PROVISIONAL,
|
||||
MIDORI_LOAD_COMMITTED,
|
||||
MIDORI_LOAD_FINISHED
|
||||
} MidoriLoadStatus;
|
||||
|
||||
GType
|
||||
midori_load_status_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define MIDORI_TYPE_LOAD_STATUS \
|
||||
(midori_load_status_get_type ())
|
||||
|
||||
GType
|
||||
midori_web_view_get_type (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_web_view_new (void);
|
||||
|
||||
void
|
||||
midori_web_view_set_settings (MidoriWebView* web_view,
|
||||
MidoriWebSettings* web_settings);
|
||||
|
||||
GtkWidget*
|
||||
midori_web_view_get_proxy_menu_item (MidoriWebView* web_view);
|
||||
|
||||
GtkWidget*
|
||||
midori_web_view_get_proxy_tab_icon (MidoriWebView* web_view);
|
||||
|
||||
GtkWidget*
|
||||
midori_web_view_get_proxy_tab_title (MidoriWebView* web_view);
|
||||
|
||||
KatzeXbelItem*
|
||||
midori_web_view_get_proxy_xbel_item (MidoriWebView* web_view);
|
||||
|
||||
gdouble
|
||||
midori_web_view_get_progress (MidoriWebView* web_view);
|
||||
|
||||
MidoriLoadStatus
|
||||
midori_web_view_get_load_status (MidoriWebView* web_view);
|
||||
|
||||
const gchar*
|
||||
midori_web_view_get_display_uri (MidoriWebView* web_view);
|
||||
|
||||
const gchar*
|
||||
midori_web_view_get_display_title (MidoriWebView* web_view);
|
||||
|
||||
const gchar*
|
||||
midori_web_view_get_link_uri (MidoriWebView* web_view);
|
||||
|
||||
KatzeArray*
|
||||
midori_web_view_get_news_feeds (MidoriWebView* web_view);
|
||||
|
||||
gboolean
|
||||
midori_web_view_has_selection (MidoriWebView* web_view);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MIDORI_WEB_VIEW_H__ */
|
|
@ -24,6 +24,32 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
/**
|
||||
* sokoke_remember_argv0:
|
||||
* @argv0: the contents of argv[0] or %NULL
|
||||
*
|
||||
* Stores or retrieves the value of argv[0].
|
||||
*
|
||||
* Call it with a string for argv0 to store.
|
||||
*
|
||||
* Passing %NULL for argv0 will preserve
|
||||
* a previously stored value.
|
||||
*
|
||||
* Return value: the contents of argv[0] or %NULL
|
||||
**/
|
||||
const gchar*
|
||||
sokoke_remember_argv0 (const gchar* argv0)
|
||||
{
|
||||
static const gchar* remembered_argv0 = NULL;
|
||||
|
||||
if (argv0)
|
||||
remembered_argv0 = argv0;
|
||||
|
||||
g_return_val_if_fail (remembered_argv0 != NULL, NULL);
|
||||
|
||||
return remembered_argv0;
|
||||
}
|
||||
|
||||
static void
|
||||
error_dialog (const gchar* short_message,
|
||||
const gchar* detailed_message)
|
||||
|
@ -263,6 +289,7 @@ sokoke_widget_popup (GtkWidget* widget,
|
|||
if (!gtk_menu_get_attach_widget (menu))
|
||||
gtk_menu_attach_to_widget (menu, widget, NULL);
|
||||
|
||||
|
||||
if (widget)
|
||||
{
|
||||
SokokePopupInfo info = { widget, pos };
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
/* Many themes need this hack for small toolbars to work */
|
||||
#define GTK_ICON_SIZE_SMALL_TOOLBAR GTK_ICON_SIZE_BUTTON
|
||||
|
||||
const gchar*
|
||||
sokoke_remember_argv0 (const gchar* argv0);
|
||||
|
||||
gboolean
|
||||
sokoke_spawn_program (const gchar* command,
|
||||
const gchar* argument);
|
||||
|
|
Loading…
Reference in a new issue