mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-17 01:33:16 +03:00
fixup default toolbar button creation for depricated GTK 3 operations
This commit is contained in:
parent
23ae8ccf11
commit
50f68b11a4
10
gtk/compat.c
10
gtk/compat.c
@ -483,3 +483,13 @@ GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id)
|
||||
return nsgtk_button_new_from_stock(stock_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* exported interface documented in gtk/compat.h */
|
||||
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,10,0)
|
||||
return false;
|
||||
#else
|
||||
return gtk_stock_lookup(stock_id, item);
|
||||
#endif
|
||||
}
|
||||
|
11
gtk/compat.h
11
gtk/compat.h
@ -148,6 +148,17 @@ GtkWidget *nsgtk_image_new_from_stock(const gchar *stock_id, GtkIconSize size);
|
||||
*/
|
||||
GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id);
|
||||
|
||||
/**
|
||||
|
||||
* Fills item with the registered values for stock_id.
|
||||
*
|
||||
* Compatability interface for original deprecated in GTK 3.10
|
||||
*
|
||||
* \param stock_id the name of the stock item
|
||||
* \return TRUE if stock_id was known.
|
||||
*/
|
||||
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item);
|
||||
|
||||
GtkWidget *nsgtk_entry_new(void);
|
||||
|
||||
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf);
|
||||
|
@ -684,17 +684,21 @@ GtkWidget *nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
|
||||
switch(i) {
|
||||
|
||||
/* gtk_tool_button_new() accepts NULL args */
|
||||
#define MAKE_STOCKBUTTON(p, q) case p##_BUTTON: {\
|
||||
#define MAKE_STOCKBUTTON(p, q) \
|
||||
case p##_BUTTON: { \
|
||||
GtkStockItem item; \
|
||||
GtkWidget *w; \
|
||||
if (nsgtk_stock_lookup(q, &item) && \
|
||||
(item.label != NULL)) { \
|
||||
char *label = NULL; \
|
||||
gtk_stock_lookup(q, &item);\
|
||||
if (item.label != NULL)\
|
||||
label = remove_underscores(item.label, false);\
|
||||
GtkWidget *w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(\
|
||||
w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET( \
|
||||
theme->image[p##_BUTTON]), label)); \
|
||||
if (label != NULL) {\
|
||||
label = remove_underscores(item.label, false); \
|
||||
free(label); \
|
||||
label = NULL; \
|
||||
} else { \
|
||||
w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET( \
|
||||
theme->image[p##_BUTTON]), q)); \
|
||||
} \
|
||||
return w; \
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user