* Adds a new category with the specified label to the dialog.
*
* Since: 0.2.1
+ *
+ * Since 0.3.4 a #GtkBox is returned that can be packed into.
**/
-void
+GtkWidget*
katze_preferences_add_category (KatzePreferences* preferences,
const gchar* label,
const gchar* icon)
{
- KatzePreferencesPrivate* priv = preferences->priv;
+ KatzePreferencesPrivate* priv;
+
+ g_return_val_if_fail (KATZE_IS_PREFERENCES (preferences), NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (icon != NULL, NULL);
+
+ priv = preferences->priv;
#if HAVE_HILDON
GtkWidget* widget;
g_object_set_data (G_OBJECT (priv->toolbutton), "notebook", priv->notebook);
#endif
#endif
+
+ return priv->page;
}
#if !HAVE_HILDON
const gchar* label)
{
#if !HAVE_HILDON
- KatzePreferencesPrivate* priv = preferences->priv;
+ KatzePreferencesPrivate* priv;
+ g_return_if_fail (KATZE_IS_PREFERENCES (preferences));
+ g_return_if_fail (label != NULL);
+
+ priv = preferences->priv;
priv->sizegroup2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
priv->frame = katze_hig_frame_new (label);
gtk_container_set_border_width (GTK_CONTAINER (priv->frame), 4);
GtkWidget*
katze_preferences_new (GtkWindow* parent);
-void
+GtkWidget*
katze_preferences_add_category (KatzePreferences* preferences,
const gchar* label,
const gchar* icon);
g_free (config_file);
}
+static void
+midori_browser_show_preferences_cb (MidoriBrowser* browser,
+ KatzePreferences* preferences,
+ MidoriApp* app)
+{
+ GtkWidget* scrolled = katze_scrolled_new (NULL, NULL);
+ GtkWidget* addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
+ GList* children = gtk_container_get_children (GTK_CONTAINER (addon));
+ GtkWidget* page;
+ gtk_widget_reparent (g_list_nth_data (children, 0), scrolled);
+ g_list_free (children);
+ g_object_set (addon, "app", app, NULL);
+ gtk_widget_show (scrolled);
+ page = katze_preferences_add_category (preferences,
+ _("Extensions"), STOCK_EXTENSIONS);
+ gtk_box_pack_start (GTK_BOX (page), scrolled, TRUE, TRUE, 4);
+}
+
static void
midori_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
#endif
/* Extensions */
- addon = g_object_new (MIDORI_TYPE_EXTENSIONS, NULL);
- gtk_widget_show (addon);
- g_object_set (addon, "app", app, NULL);
- midori_panel_append_page (MIDORI_PANEL (panel), MIDORI_VIEWABLE (addon));
+ g_signal_connect (browser, "show-preferences",
+ G_CALLBACK (midori_browser_show_preferences_cb), app);
g_object_unref (panel);
}
SEND_NOTIFICATION,
POPULATE_TOOL_MENU,
QUIT,
+ SHOW_PREFERENCES,
LAST_SIGNAL
};
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ * MidoriBrowser::show-preferences:
+ * @browser: the object on which the signal is emitted
+ * @preferences: the #KatzePreferences to populate
+ *
+ * Emitted when a preference dialogue displayed, to allow
+ * adding of a new page, to be used sparingly.
+ *
+ * Since: 0.3.4
+ */
+ signals[SHOW_PREFERENCES] = g_signal_new (
+ "show-preferences",
+ G_TYPE_FROM_CLASS (class),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST),
+ 0,
+ 0,
+ NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ KATZE_TYPE_PREFERENCES);
+
class->add_tab = _midori_browser_add_tab;
class->remove_tab = _midori_browser_remove_tab;
class->activate_action = _midori_browser_activate_action;
if (!dialog)
{
dialog = midori_preferences_new (GTK_WINDOW (browser), browser->settings);
+ g_signal_emit (browser, signals[SHOW_PREFERENCES], 0, dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (midori_preferences_response_help_cb), browser);
g_signal_connect (dialog, "destroy",
#endif
#include "sokoke.h"
+#include "midori-stock.h"
#include <string.h>
#include <glib/gi18n.h>
g_object_set (renderer,
"activatable", midori_extension_is_prepared (extension),
"active", midori_extension_is_active (extension) || g_object_get_data (G_OBJECT (extension), "static"),
+ "xpad", 4,
NULL);
g_object_unref (extension);
}
+static void
+midori_extensions_treeview_render_icon_cb (GtkTreeViewColumn* column,
+ GtkCellRenderer* renderer,
+ GtkTreeModel* model,
+ GtkTreeIter* iter,
+ GtkWidget* treeview)
+{
+ g_object_set (renderer, "stock-id", STOCK_EXTENSION,
+ "stock-size", GTK_ICON_SIZE_BUTTON,
+ "xpad", 4, NULL);
+}
+
static void
midori_extensions_treeview_render_text_cb (GtkTreeViewColumn* column,
GtkCellRenderer* renderer,
{
/* Create the treeview */
GtkTreeViewColumn* column;
+ GtkCellRenderer* renderer_icon;
GtkCellRenderer* renderer_text;
GtkCellRenderer* renderer_toggle;
GtkListStore* liststore = gtk_list_store_new (1, G_TYPE_OBJECT);
G_CALLBACK (midori_extensions_cell_renderer_toggled_cb), extensions);
gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column);
column = gtk_tree_view_column_new ();
+ renderer_icon = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (column, renderer_icon, FALSE);
+ gtk_tree_view_column_set_cell_data_func (column, renderer_icon,
+ (GtkTreeCellDataFunc)midori_extensions_treeview_render_icon_cb,
+ extensions->treeview, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (extensions->treeview), column);
+ column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
renderer_text = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer_text, FALSE);