]> spindle.queued.net Git - midori/commitdiff
Add two example extensions
authorChristian Dywan <christian@twotoasts.de>
Tue, 18 Nov 2008 01:08:50 +0000 (02:08 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 18 Nov 2008 01:08:50 +0000 (02:08 +0100)
extensions/statusbar-features.c [new file with mode: 0644]
extensions/tab-panel/main.c [new file with mode: 0644]
extensions/tab-panel/tab-panel-extension.c [new file with mode: 0644]
extensions/tab-panel/tab-panel-extension.h [new file with mode: 0644]

diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c
new file mode 100644 (file)
index 0000000..26e2876
--- /dev/null
@@ -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;
+}
diff --git a/extensions/tab-panel/main.c b/extensions/tab-panel/main.c
new file mode 100644 (file)
index 0000000..83664ba
--- /dev/null
@@ -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;
+}
diff --git a/extensions/tab-panel/tab-panel-extension.c b/extensions/tab-panel/tab-panel-extension.c
new file mode 100644 (file)
index 0000000..27cdb92
--- /dev/null
@@ -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. */
+}
diff --git a/extensions/tab-panel/tab-panel-extension.h b/extensions/tab-panel/tab-panel-extension.h
new file mode 100644 (file)
index 0000000..583998b
--- /dev/null
@@ -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__ */