extend GTK 3 compatability with opacity and viewport helpers

This commit is contained in:
Vincent Sanders 2015-04-10 00:36:47 +01:00
parent 85f90899ed
commit 44c0196dbf
3 changed files with 27 additions and 2 deletions

View File

@ -493,3 +493,24 @@ gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item)
return gtk_stock_lookup(stock_id, item);
#endif
}
/* exported interface documented in gtk/compat.h */
void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity)
{
#if GTK_CHECK_VERSION(3,8,0)
gtk_widget_set_opacity(GTK_WIDGET(window), opacity);
#else
gtk_window_set_opacity(window, opacity);
#endif
}
/* exported interface documented in gtk/compat.h */
void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window,
GtkWidget *child)
{
#if GTK_CHECK_VERSION(3,8,0)
gtk_container_add(GTK_CONTAINER(window), child);
#else
gtk_scrolled_window_add_with_viewport(window, child);
#endif
}

View File

@ -159,6 +159,10 @@ GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id);
*/
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item);
void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity);
void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window, GtkWidget *child);
GtkWidget *nsgtk_entry_new(void);
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf);

View File

@ -1456,7 +1456,7 @@ MULTIHANDLER(localhistory)
-1, -1);
gtk_window_resize(g->history_window->window, width, height);
gtk_window_set_transient_for(g->history_window->window, g->window);
gtk_window_set_opacity(g->history_window->window, 0.9);
nsgtk_window_set_opacity(g->history_window->window, 0.9);
gtk_widget_show(GTK_WIDGET(g->history_window->window));
gtk_window_move(g->history_window->window, x + g->historybase, y +
g->toolbarbase);
@ -2160,7 +2160,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
nsgtk_widget_override_background_color(GTK_WIDGET(g->history_window->drawing_area),
GTK_STATE_NORMAL,
0, 0xffff, 0xffff, 0xffff);
gtk_scrolled_window_add_with_viewport(g->history_window->scrolled,
nsgtk_scrolled_window_add_with_viewport(g->history_window->scrolled,
GTK_WIDGET(g->history_window->drawing_area));
gtk_widget_show(GTK_WIDGET(g->history_window->drawing_area));