gboolean remember_last_window_size;
gint last_window_width, last_window_height;
MidoriWindowState last_window_state;
- gboolean compact_sidepanel, show_panel_controls, right_align_sidepanel;
+ gboolean compact_sidepanel, show_panel_controls;
+ gboolean right_align_sidepanel, open_panels_in_windows;
gint last_panel_position, last_panel_page;
gboolean show_menubar, show_bookmarkbar;
gboolean show_panel, show_transferbar;
"compact-sidepanel", &compact_sidepanel,
"show-panel-controls", &show_panel_controls,
"right-align-sidepanel", &right_align_sidepanel,
+ "open-panels-in-windows", &open_panels_in_windows,
"last-panel-position", &last_panel_position,
"last-panel-page", &last_panel_page,
"show-menubar", &show_menubar,
g_object_set (browser->panel, "show-titles", !compact_sidepanel,
"show-controls", show_panel_controls,
- "right-aligned", right_align_sidepanel, NULL);
+ "right-aligned", right_align_sidepanel,
+ "open-panels-in-windows", open_panels_in_windows, NULL);
gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)),
last_panel_position);
/* The browser may not yet be visible, which means that we can't set the
g_signal_handlers_unblock_by_func (browser->panel,
midori_panel_notify_show_controls_cb, browser);
}
+ else if (name == g_intern_string ("open-panels-in-windows"))
+ g_object_set (browser->panel, "open-panels-in-windows",
+ g_value_get_boolean (&value), NULL);
else if (name == g_intern_string ("always-show-tabbar"))
_toggle_tabbar_smartly (browser);
else if (name == g_intern_string ("show-menubar"))
gboolean show_titles;
gboolean show_controls;
gboolean right_aligned;
+ gboolean open_panels_in_windows;
};
struct _MidoriPanelClass
PROP_SHOW_TITLES,
PROP_SHOW_CONTROLS,
PROP_RIGHT_ALIGNED,
+ PROP_OPEN_PANELS_IN_WINDOWS,
};
enum {
"Whether the panel is aligned to the right",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * MidoriWebSettings:open-panels-in-windows:
+ *
+ * Whether to open panels in separate windows.
+ *
+ * Since: 0.2.2
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_OPEN_PANELS_IN_WINDOWS,
+ g_param_spec_boolean (
+ "open-panels-in-windows",
+ "Open panels in windows",
+ "Whether to open panels in standalone windows by default",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
GtkWidget* scrolled = g_object_get_data (G_OBJECT (window), "scrolled");
GtkWidget* toolbar = g_object_get_data (G_OBJECT (scrolled), "panel-toolbar");
GtkWidget* menuitem = g_object_get_data (G_OBJECT (scrolled), "panel-menuitem");
+ GtkWidget* viewable = _midori_panel_child_for_scrolled (panel, scrolled);
GtkToolItem* toolitem;
gint n;
gtk_container_remove (GTK_CONTAINER (vbox), scrolled);
n = gtk_notebook_append_page (GTK_NOTEBOOK (panel->notebook), scrolled, NULL);
g_object_unref (scrolled);
- toolitem = midori_panel_construct_tool_item (panel,
- MIDORI_VIEWABLE (_midori_panel_child_for_scrolled (panel, scrolled)));
+ toolitem = midori_panel_construct_tool_item (panel, MIDORI_VIEWABLE (viewable));
if (menuitem)
- {
- gtk_widget_show (menuitem);
g_object_set_data (G_OBJECT (menuitem), "toolitem", toolitem);
- }
midori_panel_set_current_page (panel, n);
return FALSE;
}
}
static void
-midori_panel_button_detach_clicked_cb (GtkWidget* toolbutton,
- MidoriPanel* panel)
+midori_panel_detach_page (MidoriPanel* panel,
+ gint n)
{
- /* FIXME: What happens when the browser is destroyed? */
- /* FIXME: What about multiple browsers? */
- /* FIXME: Should we remember if the child was detached? */
- gint n = midori_panel_get_current_page (panel);
GtkToolItem* toolitem = gtk_toolbar_get_nth_item (
GTK_TOOLBAR (panel->toolbar), n);
const gchar* title = gtk_tool_button_get_label (GTK_TOOL_BUTTON (toolitem));
GTK_NOTEBOOK (panel->toolbook), n);
GtkWidget* scrolled = gtk_notebook_get_nth_page (
GTK_NOTEBOOK (panel->notebook), n);
- GtkWidget* menuitem = g_object_get_data (G_OBJECT (scrolled), "panel-menuitem");
GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
#if HAVE_HILDON
GtkWidget* window = hildon_window_new ();
gtk_container_add (GTK_CONTAINER (window), vbox);
g_object_set_data (G_OBJECT (window), "scrolled", scrolled);
gtk_window_set_title (GTK_WINDOW (window), title);
- if (menuitem)
- gtk_widget_hide (menuitem);
g_signal_handlers_disconnect_by_func (
_midori_panel_child_for_scrolled (panel, scrolled),
midori_panel_widget_destroy_cb, toolitem);
toolitem = gtk_toolbar_get_nth_item (GTK_TOOLBAR (panel->toolbar),
n > 0 ? n - 1 : 0);
if (!gtk_notebook_get_n_pages (GTK_NOTEBOOK (panel->notebook)))
- gtk_widget_set_sensitive (toolbutton, FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (panel->button_detach), FALSE);
g_signal_connect (window, "delete-event",
G_CALLBACK (midori_panel_detached_window_delete_event_cb), panel);
gtk_widget_show (window);
}
+static void
+midori_panel_button_detach_clicked_cb (GtkWidget* toolbutton,
+ MidoriPanel* panel)
+{
+ /* FIXME: What happens when the browser is destroyed? */
+ /* FIXME: What about multiple browsers? */
+ /* FIXME: Should we remember if the child was detached? */
+ gint n = midori_panel_get_current_page (panel);
+ midori_panel_detach_page (panel, n);
+}
+
static void
midori_panel_button_align_clicked_cb (GtkWidget* toolitem,
MidoriPanel* panel)
case PROP_RIGHT_ALIGNED:
midori_panel_set_right_aligned (panel, g_value_get_boolean (value));
break;
+ case PROP_OPEN_PANELS_IN_WINDOWS:
+ panel->open_panels_in_windows = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_RIGHT_ALIGNED:
g_value_set_boolean (value, panel->right_aligned);
break;
+ case PROP_OPEN_PANELS_IN_WINDOWS:
+ g_value_set_boolean (value, panel->open_panels_in_windows);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
midori_panel_action_activate_cb (GtkRadioAction* action,
MidoriPanel* panel)
{
- gint n = katze_object_get_int (action, "value");
+ GtkWidget* viewable = g_object_get_data (G_OBJECT (action), "viewable");
+ gint n = midori_panel_page_num (panel, viewable);
- midori_panel_set_current_page (panel, n);
- g_signal_emit (panel, signals[SWITCH_PAGE], 0, n);
- gtk_widget_show (GTK_WIDGET (panel));
+ /* If the panel is detached, focus the window */
+ if (n == -1)
+ {
+ GtkWidget* toplevel = gtk_widget_get_toplevel (viewable);
+ gtk_window_present (GTK_WINDOW (toplevel));
+ return;
+ }
+
+ if (panel->open_panels_in_windows
+ && gtk_radio_action_get_current_value (action)
+ == katze_object_get_int (action, "value"))
+ midori_panel_detach_page (panel, n);
+ else
+ {
+ midori_panel_set_current_page (panel, n);
+ g_signal_emit (panel, signals[SWITCH_PAGE], 0, n);
+ gtk_widget_show (GTK_WIDGET (panel));
+ }
}
/**
action = (GtkAction*)gtk_radio_action_new (action_name,
midori_viewable_get_label (viewable),
NULL, midori_viewable_get_stock_id (viewable), n);
+ g_object_set_data (G_OBJECT (action), "viewable", viewable);
g_signal_connect (action, "activate",
G_CALLBACK (midori_panel_action_activate_cb), panel);
if (panel->action_group)
gboolean compact_sidepanel;
gboolean show_panel_controls;
gboolean right_align_sidepanel;
+ gboolean open_panels_in_windows;
MidoriStartup load_on_startup;
gchar* homepage;
PROP_COMPACT_SIDEPANEL,
PROP_SHOW_PANEL_CONTROLS,
PROP_RIGHT_ALIGN_SIDEPANEL,
+ PROP_OPEN_PANELS_IN_WINDOWS,
PROP_LOAD_ON_STARTUP,
PROP_HOMEPAGE,
FALSE,
flags));
+ /**
+ * MidoriWebSettings:open-panels-in-window:
+ *
+ * Whether to open panels in separate windows.
+ *
+ * Since: 0.2.2
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_OPEN_PANELS_IN_WINDOWS,
+ g_param_spec_boolean (
+ "open-panels-in-windows",
+ _("Open panels in separate windows"),
+ _("Whether to always open panels in separate windows"),
+ FALSE,
+ flags));
+
g_object_class_install_property (gobject_class,
PROP_LOAD_ON_STARTUP,
case PROP_RIGHT_ALIGN_SIDEPANEL:
web_settings->right_align_sidepanel = g_value_get_boolean (value);
break;
+ case PROP_OPEN_PANELS_IN_WINDOWS:
+ web_settings->open_panels_in_windows = g_value_get_boolean (value);
+ break;
case PROP_LOAD_ON_STARTUP:
web_settings->load_on_startup = g_value_get_enum (value);
case PROP_RIGHT_ALIGN_SIDEPANEL:
g_value_set_boolean (value, web_settings->right_align_sidepanel);
break;
+ case PROP_OPEN_PANELS_IN_WINDOWS:
+ g_value_set_boolean (value, web_settings->open_panels_in_windows);
+ break;
case PROP_LOAD_ON_STARTUP:
g_value_set_enum (value, web_settings->load_on_startup);