Add two example extensions
This commit is contained in:
parent
3cd50f419b
commit
9158e33567
4 changed files with 178 additions and 0 deletions
52
extensions/statusbar-features.c
Normal file
52
extensions/statusbar-features.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include <midori/midori.h>
|
||||
|
||||
void
|
||||
realign_tabs_app_add_browser_cb (MidoriApp* app,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
GtkWidget* statusbar;
|
||||
GtkWidget* bbox;
|
||||
MidoriWebSettings* settings;
|
||||
GtkWidget* button;
|
||||
|
||||
/* FIXME: Monitor each view and modify its settings individually
|
||||
instead of merely replicating the global preferences. */
|
||||
|
||||
statusbar = katze_object_get_object (browser, "statusbar");
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
settings = katze_object_get_object (browser, "settings");
|
||||
button = katze_property_proxy (settings, "auto-load-images", NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
button = katze_property_proxy (settings, "enable-scripts", NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (bbox);
|
||||
gtk_box_pack_start (GTK_BOX (statusbar), bbox, FALSE, FALSE, 3);
|
||||
}
|
||||
|
||||
MidoriExtension* extension_main (MidoriApp* app)
|
||||
{
|
||||
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
||||
"name", "Statusbar Features",
|
||||
"description", "",
|
||||
"version", "0.1",
|
||||
"authors", "Christian Dywan <christian@twotoasts.de>",
|
||||
NULL);
|
||||
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (realign_tabs_app_add_browser_cb), NULL);
|
||||
|
||||
return extension;
|
||||
}
|
45
extensions/tab-panel/main.c
Normal file
45
extensions/tab-panel/main.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "tab-panel-extension.h"
|
||||
|
||||
#include <midori/midori.h>
|
||||
|
||||
void
|
||||
tab_panel_app_add_browser_cb (MidoriApp* app,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
GtkWidget* panel;
|
||||
GtkWidget* child;
|
||||
|
||||
/* FIXME: Actually provide a tree view listing all views. */
|
||||
|
||||
panel = katze_object_get_object (browser, "panel");
|
||||
child = midori_view_new (NULL);
|
||||
gtk_widget_show (child);
|
||||
midori_panel_append_page (MIDORI_PANEL (panel), child,
|
||||
NULL, GTK_STOCK_INDEX, "Tab Panel");
|
||||
}
|
||||
|
||||
MidoriExtension* extension_main (MidoriApp* app)
|
||||
{
|
||||
MidoriExtension* extension = g_object_new (TAB_PANEL_TYPE_EXTENSION,
|
||||
"name", "Tab Panel",
|
||||
"description", "",
|
||||
"version", "0.1",
|
||||
"authors", "Christian Dywan <christian@twotoasts.de>",
|
||||
NULL);
|
||||
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (tab_panel_app_add_browser_cb), extension);
|
||||
|
||||
return extension;
|
||||
}
|
38
extensions/tab-panel/tab-panel-extension.c
Normal file
38
extensions/tab-panel/tab-panel-extension.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "tab-panel-extension.h"
|
||||
|
||||
#include <midori/midori.h>
|
||||
|
||||
struct _TabPanelExtension
|
||||
{
|
||||
MidoriExtension parent_instance;
|
||||
};
|
||||
|
||||
struct _TabPanelExtensionClass
|
||||
{
|
||||
MidoriExtensionClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (TabPanelExtension, tab_panel_extension, MIDORI_TYPE_EXTENSION);
|
||||
|
||||
static void
|
||||
tab_panel_extension_class_init (TabPanelExtensionClass* class)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
static void
|
||||
tab_panel_extension_init (TabPanelExtension* source)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
43
extensions/tab-panel/tab-panel-extension.h
Normal file
43
extensions/tab-panel/tab-panel-extension.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
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 __TAB_PANEL_EXTENSION_H__
|
||||
#define __TAB_PANEL_EXTENSION_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define TAB_PANEL_TYPE_EXTENSION \
|
||||
(midori_extension_get_type ())
|
||||
#define TAB_PANEL_EXTENSION(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), TAB_PANEL_TYPE_EXTENSION, TabPanelExtension))
|
||||
#define TAB_PANEL_EXTENSION_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), TAB_PANEL_TYPE_EXTENSION, TabPanelExtensionClass))
|
||||
#define TAB_PANEL_IS_EXTENSION(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), TAB_PANEL_TYPE_EXTENSION))
|
||||
#define TAB_PANEL_IS_EXTENSION_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), TAB_PANEL_TYPE_EXTENSION))
|
||||
#define TAB_PANEL_EXTENSION_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), TAB_PANEL_TYPE_EXTENSION, TabPanelExtensionClass))
|
||||
|
||||
typedef struct _TabPanelExtension TabPanelExtension;
|
||||
typedef struct _TabPanelExtensionClass TabPanelExtensionClass;
|
||||
|
||||
GType
|
||||
tab_panel_extension_get_type (void);
|
||||
|
||||
/* There is no API for TabPanelExtension. Please use the
|
||||
available properties and signals. */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __TAB_PANEL_EXTENSION_H__ */
|
Loading…
Reference in a new issue