_midori_browser_set_statusbar_text (MidoriBrowser* browser,
const gchar* text)
{
+ GtkWidget* view = midori_browser_get_current_tab (browser);
+ #if GTK_CHECK_VERSION (3, 2, 0)
+ gboolean is_location = FALSE;
+ #else
GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
gboolean is_location = widget && GTK_IS_ENTRY (widget)
&& GTK_IS_ALIGNMENT (gtk_widget_get_parent (widget));
+ #endif
katze_assign (browser->statusbar_text, midori_uri_format_for_display (text));
+ if (view == NULL)
+ return;
- if (!browser->show_statusbar && !is_location)
+ if (!gtk_widget_get_visible (browser->statusbar) && !is_location
+ && text && *text)
{
+ #if GTK_CHECK_VERSION (3, 2, 0)
+ midori_view_set_overlay_text (MIDORI_VIEW (view), browser->statusbar_text);
+ #else
GtkAction* action = _action_by_name (browser, "Location");
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
- if (text && *text)
- {
- midori_location_action_set_text (location_action, browser->statusbar_text);
- midori_location_action_set_icon (location_action, NULL);
- midori_location_action_set_secondary_icon (location_action, NULL);
- }
+ midori_location_action_set_text (location_action, browser->statusbar_text);
+ midori_location_action_set_icon (location_action, NULL);
+ midori_location_action_set_secondary_icon (location_action, NULL);
+ #endif
+ }
+ else if (!gtk_widget_get_visible (browser->statusbar) && !is_location)
+ {
+ #if GTK_CHECK_VERSION (3, 2, 0)
+ midori_view_set_overlay_text (MIDORI_VIEW (view), NULL);
+ #else
+ GtkAction* action = _action_by_name (browser, "Location");
+ MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
+ if (g_object_get_data (G_OBJECT (view), "news-feeds"))
+ midori_location_action_set_secondary_icon (
+ location_action, STOCK_NEWS_FEED);
else
- {
- GtkWidget* view = midori_browser_get_current_tab (browser);
- if (G_LIKELY (view))
- {
- if (g_object_get_data (G_OBJECT (view), "news-feeds"))
- midori_location_action_set_secondary_icon (
- location_action, STOCK_NEWS_FEED);
- else
- midori_location_action_set_secondary_icon (
- location_action, GTK_STOCK_JUMP_TO);
- midori_location_action_set_text (location_action,
- midori_view_get_display_uri (MIDORI_VIEW (view)));
- midori_location_action_set_icon (location_action,
- midori_view_get_icon (MIDORI_VIEW (view)));
- }
- }
+ midori_location_action_set_secondary_icon (
+ location_action, GTK_STOCK_JUMP_TO);
+ midori_location_action_set_text (location_action,
+ midori_view_get_display_uri (MIDORI_VIEW (view)));
+ midori_location_action_set_icon (location_action,
+ midori_view_get_icon (MIDORI_VIEW (view)));
+ #endif
}
else
{
gtk_statusbar_pop (GTK_STATUSBAR (browser->statusbar), 1);
gtk_statusbar_push (GTK_STATUSBAR (browser->statusbar), 1,
- browser->statusbar_text ? browser->statusbar_text : "");
+ katze_str_non_null (browser->statusbar_text));
}
}
gboolean back_forward_set;
GHashTable* memory;
GtkWidget* scrolled_window;
+
+ #if GTK_CHECK_VERSION (3, 2, 0)
+ GtkWidget* overlay;
+ GtkWidget* overlay_label;
+ #endif
};
struct _MidoriViewClass
view->scrolled_window = katze_scrolled_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->scrolled_window),
GTK_SHADOW_NONE);
+
+ #if GTK_CHECK_VERSION(3, 2, 0)
+ view->overlay = gtk_overlay_new ();
+ gtk_widget_show (view->overlay);
+ gtk_container_add (GTK_CONTAINER (view->overlay), view->scrolled_window);
+ gtk_box_pack_start (GTK_BOX (view), view->overlay, TRUE, TRUE, 0);
+
+ view->overlay_label = gtk_label_new (NULL);
+ gtk_widget_set_halign (view->overlay_label, GTK_ALIGN_START);
+ gtk_widget_set_valign (view->overlay_label, GTK_ALIGN_END);
+ gtk_overlay_add_overlay (GTK_OVERLAY (view->overlay), view->overlay_label);
+ #else
gtk_box_pack_start (GTK_BOX (view), view->scrolled_window, TRUE, TRUE, 0);
+ #endif
g_signal_connect (view->item, "meta-data-changed",
G_CALLBACK (midori_view_item_meta_data_changed), view);
}
}
+/**
+ * midori_view_set_overlay_text:
+ * @view: a #MidoriView
+ * @text: a URI or text string
+ *
+ * Show a specified URI or text on top of the view.
+ * Has no effect with < GTK+ 3.2.0.
+ *
+ * Since: 0.4.5
+ **/
+void
+midori_view_set_overlay_text (MidoriView* view,
+ const gchar* text)
+{
+ g_return_if_fail (MIDORI_IS_VIEW (view));
+
+ #if GTK_CHECK_VERSION (3, 2, 0)
+ if (text == NULL)
+ gtk_widget_hide (view->overlay_label);
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (view->overlay_label), text);
+ gtk_widget_show (view->overlay_label);
+ }
+ #endif
+}
+
/**
* midori_view_is_blank:
* @view: a #MidoriView