midori_panel_construct_menu_item (MidoriPanel* panel,
MidoriViewable* viewable);
+static void
+midori_browser_settings_notify (MidoriWebSettings* web_settings,
+ GParamSpec* pspec,
+ MidoriBrowser* browser);
+
static GtkAction*
_action_by_name (MidoriBrowser* browser,
const gchar* name)
g_object_set (browser->settings, "last-panel-page", page, NULL);
}
+static void
+midori_panel_notify_show_titles_cb (MidoriPanel* panel,
+ GParamSpec* pspec,
+ MidoriBrowser* browser)
+{
+ gboolean show_titles = katze_object_get_boolean (panel, "show-titles");
+ if (browser->settings)
+ {
+ g_signal_handlers_block_by_func (browser->settings,
+ midori_browser_settings_notify, browser);
+ g_object_set (browser->settings, "compact-sidepanel", !show_titles, NULL);
+ g_signal_handlers_unblock_by_func (browser->settings,
+ midori_browser_settings_notify, browser);
+ }
+}
+
+static void
+midori_panel_notify_show_controls_cb (MidoriPanel* panel,
+ GParamSpec* pspec,
+ MidoriBrowser* browser)
+{
+ gboolean show_controls = katze_object_get_boolean (panel, "show-controls");
+ if (browser->settings)
+ {
+ g_signal_handlers_block_by_func (browser->settings,
+ midori_browser_settings_notify, browser);
+ g_object_set (browser->settings, "show-panel-controls", show_controls, NULL);
+ g_signal_handlers_unblock_by_func (browser->settings,
+ midori_browser_settings_notify, browser);
+ }
+}
+
static void
midori_panel_notify_right_aligned_cb (MidoriPanel* panel,
GParamSpec* pspec,
browser->panel = g_object_new (MIDORI_TYPE_PANEL,
"menu", browser->menu_tools,
NULL);
- g_signal_connect (browser->panel, "notify::page",
- G_CALLBACK (midori_panel_notify_page_cb), browser);
- g_signal_connect (browser->panel, "notify::right-aligned",
- G_CALLBACK (midori_panel_notify_right_aligned_cb), browser);
- g_signal_connect (browser->panel, "close",
- G_CALLBACK (midori_panel_close_cb), browser);
+ g_object_connect (browser->panel,
+ "signal::notify::page",
+ midori_panel_notify_page_cb, browser,
+ "signal::notify::show-titles",
+ midori_panel_notify_show_titles_cb, browser,
+ "signal::notify::show-controls",
+ midori_panel_notify_show_controls_cb, browser,
+ "signal::notify::right-aligned",
+ midori_panel_notify_right_aligned_cb, browser,
+ "signal::close",
+ midori_panel_close_cb, browser,
+ NULL);
gtk_paned_pack1 (GTK_PANED (hpaned), browser->panel, FALSE, FALSE);
/* Notebook, containing all views */
gboolean remember_last_window_size;
gint last_window_width, last_window_height;
MidoriWindowState last_window_state;
- gboolean compact_sidepanel, right_align_sidepanel;
+ gboolean compact_sidepanel, show_panel_controls, right_align_sidepanel;
gint last_panel_position, last_panel_page;
gboolean show_menubar, show_bookmarkbar;
gboolean show_panel, show_transferbar;
"last-window-height", &last_window_height,
"last-window-state", &last_window_state,
"compact-sidepanel", &compact_sidepanel,
+ "show-panel-controls", &show_panel_controls,
"right-align-sidepanel", &right_align_sidepanel,
"last-panel-position", &last_panel_position,
"last-panel-page", &last_panel_page,
}
}
- midori_panel_set_compact (MIDORI_PANEL (browser->panel), compact_sidepanel);
- midori_panel_set_right_aligned (MIDORI_PANEL (browser->panel),
- right_align_sidepanel);
+ g_object_set (browser->panel, "show-titles", !compact_sidepanel,
+ "show-controls", show_panel_controls,
+ "right-aligned", right_align_sidepanel, 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
else if (name == g_intern_string ("toolbar-items"))
_midori_browser_set_toolbar_items (browser, g_value_get_string (&value));
else if (name == g_intern_string ("compact-sidepanel"))
- midori_panel_set_compact (MIDORI_PANEL (browser->panel),
- g_value_get_boolean (&value));
+ g_object_set (browser->panel, "show-titles",
+ !g_value_get_boolean (&value), NULL);
+ else if (name == g_intern_string ("show-controls"))
+ g_object_set (browser->panel, "show-controls",
+ 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-navigationbar"))
{
GtkHBox parent_instance;
+ GtkWidget* labelbar;
GtkWidget* toolbar;
GtkToolItem* button_align;
GtkToolItem* button_detach;
GtkWidget* notebook;
GtkMenu* menu;
+ gboolean show_titles;
+ gboolean show_controls;
gboolean right_aligned;
};
PROP_SHADOW_TYPE,
PROP_MENU,
PROP_PAGE,
+ PROP_SHOW_TITLES,
+ PROP_SHOW_CONTROLS,
PROP_RIGHT_ALIGNED,
};
-1, G_MAXINT, -1,
flags));
+ /**
+ * MidoriWebSettings:show-titles:
+ *
+ * Whether to show panel titles.
+ *
+ * Since: 0.1.9
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SHOW_TITLES,
+ g_param_spec_boolean (
+ "show-titles",
+ "Show Titles",
+ "Whether to show panel titles",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * MidoriWebSettings:show-controls:
+ *
+ * Whether to show operating controls.
+ *
+ * Since: 0.1.9
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SHOW_CONTROLS,
+ g_param_spec_boolean (
+ "show-controls",
+ "Show Controls",
+ "Whether to show operating controls",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* MidoriWebSettings:right-aligned:
*
GtkWidget* labelbar;
GtkToolItem* toolitem;
+ panel->show_titles = TRUE;
+ panel->show_controls = TRUE;
panel->right_aligned = FALSE;
/* Create the sidebar */
/* Create the titlebar */
labelbar = gtk_toolbar_new ();
+ panel->labelbar = labelbar;
gtk_toolbar_set_icon_size (GTK_TOOLBAR (labelbar), GTK_ICON_SIZE_MENU);
gtk_toolbar_set_style (GTK_TOOLBAR (labelbar), GTK_TOOLBAR_ICONS);
toolitem = gtk_tool_item_new ();
case PROP_PAGE:
midori_panel_set_current_page (panel, g_value_get_int (value));
break;
+ case PROP_SHOW_TITLES:
+ panel->show_titles = g_value_get_boolean (value);
+ #if HAVE_HILDON
+ panel->show_titles = TRUE;
+ #endif
+ gtk_toolbar_set_style (GTK_TOOLBAR (panel->toolbar),
+ panel->show_titles ? GTK_TOOLBAR_BOTH : GTK_TOOLBAR_ICONS);
+ break;
+ case PROP_SHOW_CONTROLS:
+ panel->show_controls = g_value_get_boolean (value);
+ sokoke_widget_set_visible (panel->labelbar, panel->show_controls);
+ sokoke_widget_set_visible (panel->toolbar, panel->show_controls);
+ break;
case PROP_RIGHT_ALIGNED:
midori_panel_set_right_aligned (panel, g_value_get_boolean (value));
break;
case PROP_PAGE:
g_value_set_int (value, midori_panel_get_current_page (panel));
break;
+ case PROP_SHOW_TITLES:
+ g_value_set_boolean (value, panel->show_titles);
+ break;
+ case PROP_SHOW_CONTROLS:
+ g_value_set_boolean (value, panel->show_controls);
+ break;
case PROP_RIGHT_ALIGNED:
g_value_set_boolean (value, panel->right_aligned);
break;
* @compact: %TRUE if the panel should be compact
*
* Determines if the panel should be compact.
+ *
+ * Deprecated: 0.1.9
**/
void
midori_panel_set_compact (MidoriPanel* panel,
{
g_return_if_fail (MIDORI_IS_PANEL (panel));
- #if HAVE_HILDON
- compact = TRUE;
- #endif
- gtk_toolbar_set_style (GTK_TOOLBAR (panel->toolbar),
- compact ? GTK_TOOLBAR_ICONS : GTK_TOOLBAR_BOTH);
+ g_object_set (panel, "show-titles", !compact, NULL);
}
/**
return toolitem;
}
+static void
+midori_panel_show_titles_toggled_cb (GtkWidget* menuitem,
+ MidoriPanel* panel)
+{
+ g_object_set (panel, "show-titles", !panel->show_titles, NULL);
+}
+
+static void
+midori_panel_show_controls_toggled_cb (GtkWidget* menuitem,
+ MidoriPanel* panel)
+{
+ g_object_set (panel, "show-controls", !panel->show_controls, NULL);
+}
+
+static void
+midori_panel_options_clicked_cb (GtkToolItem* toolitem,
+ MidoriPanel* panel)
+{
+ gint n;
+ GtkWidget* viewable;
+ GtkWidget* menu;
+ GtkWidget* menuitem;
+
+ n = midori_panel_get_current_page (panel);
+ viewable = midori_panel_get_nth_page (panel, n);
+ menu = gtk_menu_new ();
+ #if !HAVE_HILDON
+ menuitem = gtk_check_menu_item_new_with_mnemonic (_("Show panel _titles"));
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
+ panel->show_titles);
+ g_signal_connect (menuitem, "toggled",
+ G_CALLBACK (midori_panel_show_titles_toggled_cb), panel);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ gtk_widget_show (menuitem);
+ #endif
+ menuitem = gtk_check_menu_item_new_with_mnemonic (_("Show operating _controls"));
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
+ panel->show_controls);
+ g_signal_connect (menuitem, "toggled",
+ G_CALLBACK (midori_panel_show_controls_toggled_cb), panel);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+ gtk_widget_show (menuitem);
+ g_signal_emit_by_name (viewable, "populate-option-menu", menu);
+
+ katze_widget_popup (GTK_WIDGET (toolitem), GTK_MENU (menu),
+ NULL, SOKOKE_MENU_POSITION_LEFT);
+}
+
/**
* midori_panel_append_page:
* @panel: a #MidoriPanel
GObjectClass* gobject_class;
GtkWidget* widget;
GtkWidget* toolbar;
+ GtkToolItem* toolitem;
const gchar* label;
guint n;
gtk_container_add (GTK_CONTAINER (panel->notebook), scrolled);
toolbar = midori_viewable_get_toolbar (viewable);
+ toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_PROPERTIES);
+ gtk_tool_item_set_tooltip_text (toolitem, _("Options"));
+ g_signal_connect (toolitem, "clicked",
+ G_CALLBACK (midori_panel_options_clicked_cb), panel);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, 0);
+ gtk_widget_show (GTK_WIDGET (toolitem));
gtk_widget_show (toolbar);
gtk_container_add (GTK_CONTAINER (panel->toolbook), toolbar);
g_signal_connect (viewable, "destroy",
#if !HAVE_HILDON
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
INDENTED_ADD (button, 0, 1, 3, 4);
- button = katze_property_proxy (settings, "compact-sidepanel", NULL);
- WIDGET_ADD (button, 1, 2, 3, 4);
+ button = katze_property_proxy (settings, "open-popups-in-tabs", NULL);
+ SPANNED_ADD (button, 1, 2, 3, 4);
#endif
- /* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL);
- SPANNED_ADD (button, 0, 1, 4, 5);*/
button = katze_property_proxy (settings, "open-tabs-next-to-current", NULL);
WIDGET_ADD (button, 0, 1, 5, 6);
button = katze_property_proxy (settings, "close-buttons-on-tabs", NULL);
#include <glib/gi18n.h>
+enum {
+ POPULATE_OPTION_MENU,
+
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
static void
midori_viewable_base_init (MidoriViewableIface* iface);
if (initialized)
return;
+ /**
+ * MidoriViewable::populate-option-menu:
+ * @viewable: the object on which the signal is emitted
+ * @menu: the #GtkMenu to populate
+ *
+ * Emitted when an Option menu is displayed, for instance
+ * when the user clicks the Options button in the panel.
+ *
+ * Since: 0.1.9
+ */
+ signals[POPULATE_OPTION_MENU] = g_signal_new (
+ "populate-option-menu",
+ G_TYPE_FROM_INTERFACE (iface),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST),
+ 0,
+ 0,
+ NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_MENU);
+
iface->p = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
iface->get_stock_id = midori_viewable_default_get_stock_id;
toolbar = MIDORI_VIEWABLE_GET_IFACE (viewable)->get_toolbar (viewable);
if (!toolbar)
- toolbar = gtk_event_box_new ();
+ toolbar = gtk_toolbar_new ();
return toolbar;
}
gboolean search_engines_in_completion;
gchar* toolbar_items;
gboolean compact_sidepanel;
+ gboolean show_panel_controls;
gboolean right_align_sidepanel;
MidoriStartup load_on_startup;
PROP_SEARCH_ENGINES_IN_COMPLETION,
PROP_TOOLBAR_ITEMS,
PROP_COMPACT_SIDEPANEL,
+ PROP_SHOW_PANEL_CONTROLS,
PROP_RIGHT_ALIGN_SIDEPANEL,
PROP_LOAD_ON_STARTUP,
FALSE,
flags));
+ /**
+ * MidoriWebSettings:show-panel-controls:
+ *
+ * Whether to show the operating controls of the panel.
+ *
+ * Since: 0.1.9
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SHOW_PANEL_CONTROLS,
+ g_param_spec_boolean (
+ "show-panel-controls",
+ _("Show operating controls of the panel"),
+ _("Whether to show the operating controls of the panel"),
+ TRUE,
+ flags));
+
/**
* MidoriWebSettings:right-sidepanel:
*
web_settings->notify_transfer_completed = TRUE;
web_settings->download_folder = g_strdup (midori_get_download_dir ());
web_settings->http_proxy = NULL;
+ web_settings->show_panel_controls = TRUE;
web_settings->open_popups_in_tabs = TRUE;
web_settings->remember_last_form_inputs = TRUE;
web_settings->remember_last_downloaded_files = TRUE;
case PROP_COMPACT_SIDEPANEL:
web_settings->compact_sidepanel = g_value_get_boolean (value);
break;
+ case PROP_SHOW_PANEL_CONTROLS:
+ web_settings->show_panel_controls = g_value_get_boolean (value);
+ break;
case PROP_RIGHT_ALIGN_SIDEPANEL:
web_settings->right_align_sidepanel = g_value_get_boolean (value);
break;
case PROP_COMPACT_SIDEPANEL:
g_value_set_boolean (value, web_settings->compact_sidepanel);
break;
+ case PROP_SHOW_PANEL_CONTROLS:
+ g_value_set_boolean (value, web_settings->show_panel_controls);
+ break;
case PROP_RIGHT_ALIGN_SIDEPANEL:
g_value_set_boolean (value, web_settings->right_align_sidepanel);
break;