/* "hide-close-on-minimized-tabs" has changed */
static void _interface_tweaks_on_hide_close_on_minimized_tabs_changed(InterfaceTweaks *self, gboolean inValue)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));

	InterfaceTweaksPrivate	*priv=self->priv;
	GList					*browsers, *browsersIter;
	GList					*tabs, *tabsIter;

	/* If value changed set it and emit notification of property change */
	if(priv->hideCloseOnMinimizedTabs!=inValue || !priv->inited)
	{
		/* Change property */
		priv->hideCloseOnMinimizedTabs=inValue;
		if(priv->inited) midori_extension_set_boolean(priv->extension, "hide-close-on-minimized-tabs", priv->hideCloseOnMinimizedTabs);

		/* Apply new value to all tabs in all browsers */
		browsers=midori_app_get_browsers(priv->application);
		for(browsersIter=browsers; browsersIter; browsersIter=g_list_next(browsersIter))
		{
			tabs=midori_browser_get_tabs(MIDORI_BROWSER(browsersIter->data));
			for(tabsIter=tabs; tabsIter; tabsIter=g_list_next(tabsIter))
			{
				_interface_tweaks_on_notify_minimized_tab_for_close_button(self, NULL, MIDORI_VIEW(tabsIter->data));
			}
			g_list_free(tabs);
		}
		g_list_free(browsers);

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), InterfaceTweaksProperties[PROP_HIDE_CLOSE_ON_MINIMIZED_TABS]);
	}
}
/* "group-minimized-tabs" has changed */
static void _interface_tweaks_on_group_minimized_tabs_changed(InterfaceTweaks *self, gboolean inValue)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));

	InterfaceTweaksPrivate	*priv=self->priv;
	GList					*browsers, *browsersIter;
	GList					*tabs, *tabsIter;
	MidoriBrowser			*browser;
	GtkNotebook				*notebook;
	MidoriView				*view;
	gboolean				minimized;

	/* If value changed set it and emit notification of property change */
	if(priv->groupMinimizedTabs!=inValue || !priv->inited)
	{
		/* Change property */
		priv->groupMinimizedTabs=inValue;
		if(priv->inited) midori_extension_set_boolean(priv->extension, "group-minimized-tabs", priv->groupMinimizedTabs);

		/* Move minimized tabs in all browsers to front if activated */
		if(priv->groupMinimizedTabs)
		{
			browsers=midori_app_get_browsers(priv->application);
			for(browsersIter=browsers; browsersIter; browsersIter=g_list_next(browsersIter))
			{
				browser=MIDORI_BROWSER(browsersIter->data);
				if(browser)
				{
					notebook=NULL;
					g_object_get(browser, "notebook", &notebook, NULL);
					if(notebook)
					{
						tabs=midori_browser_get_tabs(MIDORI_BROWSER(browsersIter->data));
						for(tabsIter=tabs; tabsIter; tabsIter=g_list_next(tabsIter))
						{
							view=MIDORI_VIEW(tabsIter->data);
							if(view)
							{
								g_signal_handlers_block_by_func(view, G_CALLBACK(_interface_tweaks_on_notify_minimized_tab_for_group_tabs), self);

								minimized=FALSE;
								g_object_get(view, "minimized", &minimized, NULL);
								if(minimized) gtk_notebook_reorder_child(GTK_NOTEBOOK(notebook), GTK_WIDGET(view), 0);

								g_signal_handlers_unblock_by_func(view, G_CALLBACK(_interface_tweaks_on_notify_minimized_tab_for_group_tabs), self);
							}
						}
						g_list_free(tabs);

						g_object_unref(notebook);
					}
				}
			}
			g_list_free(browsers);
		}

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), InterfaceTweaksProperties[PROP_GROUP_MINIMIZED_TABS]);
	}
}
Esempio n. 3
0
static void _cookie_permission_manager_when_ask_expander_changed(CookiePermissionManager *self,
																	GParamSpec *inSpec,
																	gpointer inUserData)
{
	GtkExpander			*expander=GTK_EXPANDER(inUserData);

	midori_extension_set_boolean(self->priv->extension, "show-details-when-ask", gtk_expander_get_expanded(expander));
}
Esempio n. 4
0
static void
colorful_tabs_button_toggled_cb (GtkWidget*       button,
                                 MidoriExtension* extension)
{
    MidoriBrowser* browser = MIDORI_BROWSER (gtk_widget_get_toplevel (button));

    midori_extension_set_boolean (extension, "tint",
                                  !midori_extension_get_boolean (extension, "tint"));
    midori_browser_foreach (browser,
                            (GtkCallback)colorful_tabs_browser_foreach_cb, extension);
}
/* "autocomplete-locationbar" has changed */
static void _interface_tweaks_on_autocomplete_locationbar_changed(InterfaceTweaks *self, gboolean inValue)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));

	InterfaceTweaksPrivate	*priv=self->priv;

	/* If value changed set it and emit notification of property change */
	if(priv->autocompleteLocationbar!=inValue || !priv->inited)
	{
		/* Change property */
		priv->autocompleteLocationbar=inValue;
		if(priv->inited) midori_extension_set_boolean(priv->extension, "autocomplete-locationbar", priv->autocompleteLocationbar);

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), InterfaceTweaksProperties[PROP_AUTOCOMPLETE_LOCATIONBAR]);
	}
}
/* "show-start-request-throbber" has changed */
static void _interface_tweaks_on_show_start_request_throbber_changed(InterfaceTweaks *self, gboolean inValue)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));

	InterfaceTweaksPrivate	*priv=self->priv;

	/* If value changed set it and emit notification of property change */
	if(priv->showStartRequestThrobber!=inValue || !priv->inited)
	{
		/* Change property */
		priv->showStartRequestThrobber=inValue;
		if(priv->inited) midori_extension_set_boolean(priv->extension, "show-start-request-throbber", priv->showStartRequestThrobber);

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), InterfaceTweaksProperties[PROP_SHOW_START_REQUEST_THROBBER]);
	}
}
/* "small-toolbar" has changed */
static void _interface_tweaks_on_small_toolbar_changed(InterfaceTweaks *self, gboolean inValue)
{
	g_return_if_fail(IS_INTERFACE_TWEAKS(self));

	InterfaceTweaksPrivate	*priv=self->priv;

	/* If value changed set it and emit notification of property change */
	if(priv->smallToolbar!=inValue || !priv->inited)
	{
		/* Change property */
		priv->smallToolbar=inValue;
		if(priv->inited) midori_extension_set_boolean(priv->extension, "small-toolbar", priv->smallToolbar);

		/* If small toolbar should be displayed remember current settings */
		if(inValue==TRUE)
		{
			/* Get old toolbar values */
			g_object_get(gtk_settings_get_default(),
							"gtk-toolbar-icon-size", &priv->originToolbarIconSize,
							"gtk-toolbar-style", &priv->originToolbarStyle,
							NULL);

			/* Set new toolbar values */
			g_object_set(gtk_settings_get_default(),
							"gtk-toolbar-icon-size", GTK_ICON_SIZE_SMALL_TOOLBAR,
							"gtk-toolbar-style", GTK_TOOLBAR_ICONS,
							NULL);
		}
			/* Otherwise restore old settings */
			else
			{
				if(priv->inited==TRUE)
				{
					/* Set old toolbar values */
					g_object_set(gtk_settings_get_default(),
									"gtk-toolbar-icon-size", priv->originToolbarIconSize,
									"gtk-toolbar-style", priv->originToolbarStyle,
									NULL);
				}
			}

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), InterfaceTweaksProperties[PROP_SMALL_TOOLBAR]);
	}
}
Esempio n. 8
0
static void
formhistory_preferences_response_cb (GtkWidget*       dialog,
                                     gint             response_id,
                                     MidoriExtension* extension)
{
    GtkWidget* checkbox;
    gboolean old_state;
    gboolean new_state;
    MidoriApp* app;
    KatzeArray* browsers;
    MidoriBrowser* browser;

    if (response_id == GTK_RESPONSE_APPLY)
    {
        checkbox = g_object_get_data (G_OBJECT (dialog), "always-load-checkbox");
        new_state = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
        old_state = midori_extension_get_boolean (extension, "always-load");

        if (old_state != new_state)
        {
            midori_extension_set_boolean (extension, "always-load", new_state);

            app = midori_extension_get_app (extension);
            browsers = katze_object_get_object (app, "browsers");
            KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
            {
                GList* tabs = midori_browser_get_tabs (browser);
                for (; tabs; tabs = g_list_next (tabs))
                    formhistory_deactivate_tab (tabs->data, extension);
                g_signal_handlers_disconnect_by_func (
                    browser, formhistory_add_tab_cb, extension);

                if (new_state)
                {
                    for (; tabs; tabs = g_list_next (tabs))
                        formhistory_add_tab_cb (browser, tabs->data, extension);
                    g_signal_connect (browser, "add-tab",
                        G_CALLBACK (formhistory_add_tab_cb), extension);
                }
                g_list_free (tabs);
            }