panel = katze_object_get_object (browser, "panel");
/* Transfers */
- /* addon = midori_view_new (net);
+ #if 0
+ addon = midori_view_new (net);
gtk_widget_show (addon);
midori_panel_append_page (MIDORI_PANEL (panel), addon, NULL,
- STOCK_TRANSFERS, _("Transfers")); */
+ STOCK_TRANSFERS, _("Transfers"));
+ #endif
/* Console */
addon = midori_console_new ();
G_CALLBACK (midori_browser_add_tab_cb), addon);
/* Userscripts */
- addon = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_USER_SCRIPTS);
+ addon = midori_addons_new (MIDORI_ADDON_USER_SCRIPTS, GTK_WIDGET (browser));
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);
+ addon = midori_addons_new (MIDORI_ADDON_USER_STYLES, GTK_WIDGET (browser));
gtk_widget_show (addon);
toolbar = midori_addons_get_toolbar (MIDORI_ADDONS (addon));
gtk_widget_show (toolbar);
STOCK_STYLES, _("Userstyles"));
/* Extensions */
- addon = midori_addons_new (GTK_WIDGET (browser), MIDORI_ADDON_EXTENSIONS);
+ #if 0
+ addon = midori_addons_new (MIDORI_ADDON_EXTENSIONS,
+ katze_object_get_object (app, "extensions"), NULL);
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"));
+ #endif
}
static void
{
GtkVBox parent_instance;
- GtkWidget* web_widget;
MidoriAddonKind kind;
+ GtkWidget* web_widget;
GtkWidget* toolbar;
GtkWidget* treeview;
{
PROP_0,
- PROP_WEB_WIDGET,
- PROP_KIND
+ PROP_KIND,
+ PROP_WEB_WIDGET
};
static void
{
static const GEnumValue values[] = {
{ MIDORI_ADDON_NONE, "MIDORI_ADDON_NONE", N_("None") },
- { MIDORI_ADDON_EXTENSIONS, "MIDORI_ADDON_EXTENSIONS", N_("Extensions") },
{ MIDORI_ADDON_USER_SCRIPTS, "MIDORI_USER_SCRIPTS", N_("Userscripts") },
{ MIDORI_ADDON_USER_STYLES, "MIDORI_USER_STYLES", N_("Userstyles") },
{ 0, NULL, NULL }
flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
- g_object_class_install_property (gobject_class,
- PROP_WEB_WIDGET,
- g_param_spec_object (
- "web-widget",
- "Web Widget",
- "The assigned web widget",
- GTK_TYPE_WIDGET,
- G_PARAM_READWRITE));
-
g_object_class_install_property (gobject_class,
PROP_KIND,
g_param_spec_enum (
MIDORI_TYPE_ADDON_KIND,
MIDORI_ADDON_NONE,
flags));
+
+ g_object_class_install_property (gobject_class,
+ PROP_WEB_WIDGET,
+ g_param_spec_object (
+ "web-widget",
+ "Web Widget",
+ "The assigned web widget",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
}
static void
switch (prop_id)
{
- case PROP_WEB_WIDGET:
- midori_addons_set_web_widget (addons, g_value_get_object (value));
- break;
case PROP_KIND:
- midori_addons_set_kind (addons, g_value_get_enum (value));
+ addons->kind = g_value_get_enum (value);
+ break;
+ case PROP_WEB_WIDGET:
+ katze_object_assign (addons->web_widget, g_value_dup_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
switch (prop_id)
{
- case PROP_WEB_WIDGET:
- g_value_set_object (value, midori_addons_get_web_widget (addons));
- break;
case PROP_KIND:
- g_value_set_enum (value, midori_addons_get_kind (addons));
+ g_value_set_enum (value, addons->kind);
+ break;
+ case PROP_WEB_WIDGET:
+ g_value_set_object (value, addons->web_widget);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
{
switch (addons->kind)
{
- case MIDORI_ADDON_EXTENSIONS:
- return "extensions";
case MIDORI_ADDON_USER_SCRIPTS:
return "scripts";
case MIDORI_ADDON_USER_STYLES:
{
switch (addons->kind)
{
- case MIDORI_ADDON_EXTENSIONS:
- return ".midori.js";
case MIDORI_ADDON_USER_SCRIPTS:
return ".user.js";
case MIDORI_ADDON_USER_STYLES:
midori_addons_finalize (GObject* object)
{
MidoriAddons* addons = MIDORI_ADDONS (object);
+
+ katze_object_assign (addons->web_widget, NULL);
+
g_slist_free (addons->elements);
}
/**
* midori_addons_new:
- * @web_widget: a web widget
* @kind: the kind of addon
+ * @web_widget: a web widget
*
* Creates a new addons widget.
*
* Return value: a new #MidoriAddons
**/
GtkWidget*
-midori_addons_new (GtkWidget* web_widget,
- MidoriAddonKind kind)
+midori_addons_new (MidoriAddonKind kind,
+ GtkWidget* web_widget)
{
MidoriAddons* addons;
#if GLIB_CHECK_VERSION (2, 16, 0)
g_return_val_if_fail (GTK_IS_WIDGET (web_widget), NULL);
addons = g_object_new (MIDORI_TYPE_ADDONS,
- /* "web-widget", web_widget,
- "kind", kind, */ NULL);
- addons->web_widget = web_widget;
- midori_addons_set_kind (addons, kind);
+ "kind", kind,
+ "web-widget", web_widget,
+ NULL);
+
+ if (kind == MIDORI_ADDON_USER_SCRIPTS || kind == MIDORI_ADDON_USER_STYLES)
+ g_signal_connect (addons->web_widget, "window-object-cleared",
+ G_CALLBACK (midori_web_widget_window_object_cleared_cb), addons);
+
midori_addons_update_elements (addons);
#if GLIB_CHECK_VERSION (2, 16, 0)
return GTK_WIDGET (addons);
}
-/**
- * midori_addons_set_web_widget:
- * @addons: a #MidoriAddons
- * @web_widget: a web widget
- *
- * Sets the assigned web widget. Basically any widget
- * with a window-object-cleared qualifies as such.
- *
- * Note: This may only be set once.
- **/
-void
-midori_addons_set_web_widget (MidoriAddons* addons,
- GtkWidget* web_widget)
-{
- g_return_if_fail (MIDORI_IS_ADDONS (addons));
- g_return_if_fail (GTK_IS_WIDGET (addons));
- g_return_if_fail (g_signal_lookup ("window-object-cleared", G_TYPE_FROM_INSTANCE (web_widget)));
-
- /* FIXME: Implement this */
-}
-
-/**
- * midori_addons_get_web_widget:
- * @addons: a #MidoriAddons
- *
- * Determines the assigned web widget.
- *
- * Return value: a web widget
- **/
-GtkWidget*
-midori_addons_get_web_widget (MidoriAddons* addons)
-{
- g_return_val_if_fail (MIDORI_IS_ADDONS (addons), NULL);
-
- return addons->web_widget;
-}
-
-/**
- * midori_addons_set_kind:
- * @addons: a #MidoriAddons
- * @kind: a #MidoriAddonKind
- *
- * Sets the kind of addons.
- *
- * Note: This may only be set once.
- **/
-void
-midori_addons_set_kind (MidoriAddons* addons,
- MidoriAddonKind kind)
-{
- g_return_if_fail (MIDORI_IS_ADDONS (addons));
- g_return_if_fail (addons->kind == MIDORI_ADDON_NONE);
-
- if (kind == MIDORI_ADDON_NONE)
- return;
-
- g_return_if_fail (addons->web_widget);
-
- addons->kind = kind;
-
- if (kind == MIDORI_ADDON_USER_SCRIPTS || kind == MIDORI_ADDON_USER_STYLES)
- g_signal_connect (addons->web_widget, "window-object-cleared",
- G_CALLBACK (midori_web_widget_window_object_cleared_cb), addons);
-
- g_object_notify (G_OBJECT (addons), "kind");
-}
-
-/**
- * midori_addons_get_kind:
- * @addons: a #MidoriAddons
- *
- * Determines the kind of addons.
- *
- * Return value: a #MidoriAddonKind
- **/
-MidoriAddonKind
-midori_addons_get_kind (MidoriAddons* addons)
-{
- return addons->kind;
-}
-
/**
* midori_addons_get_toolbar:
* @addons: a #MidoriAddons
GSList* list;
struct AddonElement* element;
+ g_return_if_fail (MIDORI_IS_ADDONS (addons));
g_return_if_fail (addons->kind != MIDORI_ADDON_NONE);
/* FIXME: would GHashTable be better? */