Update gtk compatability header to cope with deprication of stock icon interface

This commit is contained in:
Vincent Sanders 2015-04-08 22:21:30 +01:00
parent a6b02680a7
commit 5a14a74ab1
15 changed files with 242 additions and 156 deletions

View File

@ -36,7 +36,6 @@ $(eval $(call pkg_config_find_and_add_enabled,VIDEO,gstreamer-0.10,Video))
GTKDEPFLAGS := -DG_DISABLE_SINGLE_INCLUDES \
-DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_SINGLE_INCLUDES \
-DGTK_DISABLE_DEPRECATED \
-DGTK_MULTIHEAD_SAFE \
-DPANGO_DISABLE_DEPRECATED
@ -46,6 +45,12 @@ GTKDEPFLAGS := -DG_DISABLE_SINGLE_INCLUDES \
# libsexy currently means we cannot enable this
# -DGDK_DISABLE_DEPRECATED
# gtk3 is depricating interfaces we use a lot
ifeq ($(NETSURF_GTK_MAJOR),2)
GTKDEPFLAGS += -DGTK_DISABLE_DEPRECATED
endif
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk -g \
$(GTKDEPFLAGS) \
-D_BSD_SOURCE \

View File

@ -122,7 +122,7 @@ void nsgtk_about_dialog_init(GtkWindow *parent)
nsgtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
/* Add the OK button */
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
gtk_dialog_add_button(GTK_DIALOG(dialog), NSGTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
/* Add the credits button */

View File

@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file
* Compatibility functions for older GTK versions (implementation)
/**
* \file
* Compatibility functions for older GTK versions implementation
*/
#include <stdint.h>
@ -30,105 +31,105 @@
void nsgtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
{
#if GTK_CHECK_VERSION(2,22,0)
#if GTK_CHECK_VERSION(2,22,0)
gtk_widget_set_can_focus(widget, can_focus);
#else
#else
if (can_focus == TRUE)
GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
#endif
#endif
}
gboolean nsgtk_widget_has_focus(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,20,0)
#if GTK_CHECK_VERSION(2,20,0)
return gtk_widget_has_focus(widget);
#else
#else
return GTK_WIDGET_HAS_FOCUS(widget);
#endif
#endif
}
gboolean nsgtk_widget_get_visible(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,20,0)
#if GTK_CHECK_VERSION(2,20,0)
return gtk_widget_get_visible(widget);
#else
#else
return GTK_WIDGET_VISIBLE(widget);
#endif
#endif
}
gboolean nsgtk_widget_get_realized(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,20,0)
#if GTK_CHECK_VERSION(2,20,0)
return gtk_widget_get_realized(widget);
#else
#else
return GTK_WIDGET_REALIZED(widget);
#endif
#endif
}
gboolean nsgtk_widget_get_mapped(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,20,0)
#if GTK_CHECK_VERSION(2,20,0)
return gtk_widget_get_mapped(widget);
#else
#else
return GTK_WIDGET_MAPPED(widget);
#endif
#endif
}
gboolean nsgtk_widget_is_drawable(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,18,0)
#if GTK_CHECK_VERSION(2,18,0)
return gtk_widget_is_drawable(widget);
#else
#else
return GTK_WIDGET_DRAWABLE(widget);
#endif
#endif
}
GtkStateType nsgtk_widget_get_state(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,18,0)
#if GTK_CHECK_VERSION(2,18,0)
return gtk_widget_get_state(widget);
#else
#else
return GTK_WIDGET_STATE(widget);
#endif
#endif
}
void nsgtk_dialog_set_has_separator(GtkDialog *dialog, gboolean setting)
{
#if GTK_CHECK_VERSION(2,21,8)
#if GTK_CHECK_VERSION(2,21,8)
/* Deprecated */
#else
#else
gtk_dialog_set_has_separator(dialog, setting);
#endif
#endif
}
GtkWidget *nsgtk_combo_box_text_new(void)
{
#if GTK_CHECK_VERSION(2,24,0)
return gtk_combo_box_text_new();
#else
#if GTK_CHECK_VERSION(2,24,0)
return gtk_combo_box_text_new();
#else
return gtk_combo_box_new_text();
#endif
#endif
}
void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text)
{
#if GTK_CHECK_VERSION(2,24,0)
#if GTK_CHECK_VERSION(2,24,0)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), text);
#else
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text);
#endif
#else
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text);
#endif
}
gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
{
#if GTK_CHECK_VERSION(2,24,0)
#if GTK_CHECK_VERSION(2,24,0)
return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box));
#else
#else
return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
#endif
#endif
}
GtkWidget *nsgtk_entry_new(void)
@ -137,10 +138,12 @@ GtkWidget *nsgtk_entry_new(void)
return gtk_entry_new();
#else
return GTK_WIDGET(sexy_icon_entry_new());
#endif
#endif
}
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf)
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry,
GtkEntryIconPosition icon_pos,
GdkPixbuf *pixbuf)
{
#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_from_pixbuf(GTK_ENTRY(entry), icon_pos, pixbuf);
@ -158,12 +161,17 @@ void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition ico
#endif
}
void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id)
void nsgtk_entry_set_icon_from_stock(GtkWidget *entry,
GtkEntryIconPosition icon_pos,
const gchar *id)
{
#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, stock_id);
#if GTK_CHECK_VERSION(3,10,0)
gtk_entry_set_icon_from_icon_name(entry, icon_pos, id);
#else
GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(stock_id,
#if GTK_CHECK_VERSION(2,16,0)
gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), icon_pos, id);
#else
GtkImage *image = GTK_IMAGE(gtk_image_new_from_stock(id,
GTK_ICON_SIZE_LARGE_TOOLBAR));
if (image != NULL) {
@ -172,11 +180,25 @@ void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon
image);
g_object_unref(image);
}
#endif
#endif
}
void nsgtk_widget_override_background_color(GtkWidget *widget, GtkStateFlags state, uint16_t a, uint16_t r, uint16_t g, uint16_t b)
GtkWidget *nsgtk_image_new_from_stock(const gchar *id, GtkIconSize size)
{
#if GTK_CHECK_VERSION(3,10,0)
return gtk_image_new_from_icon_name(id, size);
#else
return gtk_image_new_from_stock(id, size);
#endif
}
void nsgtk_widget_override_background_color(GtkWidget *widget,
GtkStateFlags state,
uint16_t a,
uint16_t r,
uint16_t g,
uint16_t b)
{
#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA colour;
@ -223,7 +245,7 @@ static void nsgtk_layout_set_adjustment_step_increment(GtkAdjustment *adj,
#endif
}
void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
{
#if GTK_CHECK_VERSION(3,0,0)
gtk_scrollable_set_hadjustment(GTK_SCROLLABLE(layout), adj);
@ -233,7 +255,7 @@ void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
nsgtk_layout_set_adjustment_step_increment(adj, 8);
}
void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj)
void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj)
{
#if GTK_CHECK_VERSION(3,0,0)
gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(layout), adj);
@ -283,7 +305,8 @@ GtkStyleContext *nsgtk_widget_get_style_context(GtkWidget *widget)
#endif
}
const PangoFontDescription* nsgtk_style_context_get_font(GtkStyleContext *style, GtkStateFlags state)
const PangoFontDescription* nsgtk_style_context_get_font(GtkStyleContext *style,
GtkStateFlags state)
{
#if GTK_CHECK_VERSION(3,0,0)
return gtk_style_context_get_font(style, state);
@ -292,7 +315,9 @@ const PangoFontDescription* nsgtk_style_context_get_font(GtkStyleContext *style,
#endif
}
gulong nsgtk_connect_draw_event(GtkWidget *widget, GCallback callback, gpointer g)
gulong nsgtk_connect_draw_event(GtkWidget *widget,
GCallback callback,
gpointer g)
{
#if GTK_CHECK_VERSION(3,0,0)
return g_signal_connect(G_OBJECT(widget), "draw", callback, g);
@ -310,7 +335,8 @@ void nsgdk_cursor_unref(GdkCursor *cursor)
#endif
}
void nsgtk_widget_modify_font(GtkWidget *widget, PangoFontDescription *font_desc)
void nsgtk_widget_modify_font(GtkWidget *widget,
PangoFontDescription *font_desc)
{
#if GTK_CHECK_VERSION(3,0,0)
/* FIXME */
@ -323,92 +349,95 @@ void nsgtk_widget_modify_font(GtkWidget *widget, PangoFontDescription *font_desc
GdkWindow *nsgtk_widget_get_window(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_widget_get_window(widget);
return gtk_widget_get_window(widget);
#else
return widget->window;
return widget->window;
#endif
}
GtkWidget *nsgtk_dialog_get_content_area(GtkDialog *dialog)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_dialog_get_content_area(dialog);
return gtk_dialog_get_content_area(dialog);
#else
return dialog->vbox;
return dialog->vbox;
#endif
}
GtkWidget *nsgtk_dialog_get_action_area(GtkDialog *dialog)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_dialog_get_action_area(dialog);
return gtk_dialog_get_action_area(dialog);
#else
return dialog->action_area;
return dialog->action_area;
#endif
}
gboolean nsgtk_show_uri(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error)
gboolean nsgtk_show_uri(GdkScreen *screen,
const gchar *uri,
guint32 timestamp,
GError **error)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_show_uri(screen, uri, timestamp, error);
return gtk_show_uri(screen, uri, timestamp, error);
#else
return FALSE; /* FIXME */
return FALSE; /* FIXME */
#endif
}
GdkWindow *nsgtk_layout_get_bin_window(GtkLayout *layout)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_layout_get_bin_window(layout);
return gtk_layout_get_bin_window(layout);
#else
return layout->bin_window;
return layout->bin_window;
#endif
}
gdouble nsgtk_adjustment_get_step_increment(GtkAdjustment *adjustment)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_adjustment_get_step_increment(adjustment);
return gtk_adjustment_get_step_increment(adjustment);
#else
return adjustment->step_increment;
return adjustment->step_increment;
#endif
}
gdouble nsgtk_adjustment_get_upper(GtkAdjustment *adjustment)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_adjustment_get_upper(adjustment);
return gtk_adjustment_get_upper(adjustment);
#else
return adjustment->upper;
return adjustment->upper;
#endif
}
gdouble nsgtk_adjustment_get_lower(GtkAdjustment *adjustment)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_adjustment_get_lower(adjustment);
return gtk_adjustment_get_lower(adjustment);
#else
return adjustment->lower;
return adjustment->lower;
#endif
}
gdouble nsgtk_adjustment_get_page_increment(GtkAdjustment *adjustment)
{
#if GTK_CHECK_VERSION(2,14,0)
return gtk_adjustment_get_page_increment(adjustment);
return gtk_adjustment_get_page_increment(adjustment);
#else
return adjustment->page_increment;
return adjustment->page_increment;
#endif
}
void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
{
#if GTK_CHECK_VERSION(2,18,0)
gtk_widget_get_allocation(widget, allocation);
gtk_widget_get_allocation(widget, allocation);
#else
allocation->x = widget->allocation.x;
allocation->y = widget->allocation.y;
allocation->width = widget->allocation.width;
allocation->height = widget->allocation.height;
allocation->x = widget->allocation.x;
allocation->y = widget->allocation.y;
allocation->width = widget->allocation.width;
allocation->height = widget->allocation.height;
#endif
}

View File

@ -27,6 +27,41 @@
#include <gtk/gtk.h>
/* gtk 3.10 depricated the use of stock names */
#if GTK_CHECK_VERSION(3,10,0)
#define NSGTK_STOCK_ADD "list-add"
#define NSGTK_STOCK_CANCEL "gtk-cancel"
#define NSGTK_STOCK_CLEAR "edit-clear"
#define NSGTK_STOCK_CLOSE "window-close"
#define NSGTK_STOCK_FIND "edit-find"
#define NSGTK_STOCK_GO_BACK "go-previous"
#define NSGTK_STOCK_GO_FORWARD "go-next"
#define NSGTK_STOCK_HOME "go-home"
#define NSGTK_STOCK_INFO "dialog-information"
#define NSGTK_STOCK_REFRESH "view-refresh"
#define NSGTK_STOCK_SAVE "document-save"
#define NSGTK_STOCK_SAVE_AS "document-save-as"
#define NSGTK_STOCK_STOP "process-stop"
#define NSGTK_STOCK_OK "gtk-ok"
#define NSGTK_STOCK_OPEN "document-open"
#else
#define NSGTK_STOCK_ADD GTK_STOCK_ADD
#define NSGTK_STOCK_CANCEL GTK_STOCK_CANCEL
#define NSGTK_STOCK_CLEAR GTK_STOCK_CLEAR
#define NSGTK_STOCK_CLOSE GTK_STOCK_CLOSE
#define NSGTK_STOCK_FIND GTK_STOCK_FIND
#define NSGTK_STOCK_GO_BACK GTK_STOCK_GO_BACK
#define NSGTK_STOCK_GO_FORWARD GTK_STOCK_GO_FORWARD
#define NSGTK_STOCK_HOME GTK_STOCK_HOME
#define NSGTK_STOCK_INFO GTK_STOCK_INFO
#define NSGTK_STOCK_REFRESH GTK_STOCK_REFRESH
#define NSGTK_STOCK_SAVE GTK_STOCK_SAVE
#define NSGTK_STOCK_SAVE_AS GTK_STOCK_SAVE_AS
#define NSGTK_STOCK_STOP GTK_STOCK_STOP
#define NSGTK_STOCK_OK GTK_STOCK_OK
#define NSGTK_STOCK_OPEN GTK_STOCK_OPEN
#endif
void nsgtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus);
gboolean nsgtk_widget_has_focus(GtkWidget *widget);
gboolean nsgtk_widget_get_visible(GtkWidget *widget);
@ -74,6 +109,14 @@ enum {
GtkWidget *nsgtk_entry_new(void);
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf);
void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id);
/**
* Creates a GtkImage displaying a stock icon.
*
* Compatability interface for interface deprecated in 3.10
*/
GtkWidget *nsgtk_image_new_from_stock(const gchar *stock_id, GtkIconSize size);
void nsgtk_widget_override_background_color(GtkWidget *widget, GtkStateFlags state, uint16_t a, uint16_t r, uint16_t g, uint16_t b);
GtkWidget* nsgtk_hbox_new(gboolean homogeneous, gint spacing);
GtkWidget* nsgtk_vbox_new(gboolean homogeneous, gint spacing);

View File

@ -595,9 +595,9 @@ static gchar* nsgtk_download_dialog_show (const gchar *filename, const gchar *do
"\n\n<small>%s</small>",
message, info);
gtk_dialog_add_buttons(GTK_DIALOG(dialog), GTK_STOCK_SAVE,
GTK_RESPONSE_DOWNLOAD, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE_AS,
gtk_dialog_add_buttons(GTK_DIALOG(dialog), NSGTK_STOCK_SAVE,
GTK_RESPONSE_DOWNLOAD, NSGTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, NSGTK_STOCK_SAVE_AS,
GTK_RESPONSE_SAVE_AS, NULL);
gint result = gtk_dialog_run(GTK_DIALOG(dialog));
@ -611,8 +611,8 @@ static gchar* nsgtk_download_dialog_show (const gchar *filename, const gchar *do
(messages_get("gtkSave"),
nsgtk_download_parent,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_current_name
(GTK_FILE_CHOOSER(dialog), filename);
@ -664,12 +664,11 @@ static gchar* nsgtk_download_dialog_show (const gchar *filename, const gchar *do
"_Replace",
GTK_RESPONSE_DOWNLOAD);
gtk_button_set_image(GTK_BUTTON(button),
gtk_image_new_from_stock(
"gtk-save",
nsgtk_image_new_from_stock(
NSGTK_STOCK_SAVE,
GTK_ICON_SIZE_BUTTON));
gint result = gtk_dialog_run(GTK_DIALOG(
dialog));
gint result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_CANCEL)
destination = NULL;

View File

@ -18,17 +18,19 @@
*/
#include "utils/log.h"
#include "utils/utils.h"
#include "desktop/global_history.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
#include "desktop/textinput.h"
#include "gtk/gui.h"
#include "gtk/history.h"
#include "gtk/plotters.h"
#include "gtk/scaffolding.h"
#include "gtk/treeview.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "gtk/compat.h"
#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate( \
GtkMenuItem *widget, gpointer g)
@ -171,8 +173,8 @@ MENUHANDLER(export)
save_dialog = gtk_file_chooser_dialog_new("Save File",
wndHistory,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(save_dialog),

View File

@ -29,6 +29,7 @@
#include "gtk/plotters.h"
#include "gtk/scaffolding.h"
#include "gtk/treeview.h"
#include "gtk/compat.h"
#define GLADE_NAME "hotlist.glade"
@ -178,8 +179,8 @@ MENUHANDLER(export)
save_dialog = gtk_file_chooser_dialog_new("Save File",
wndHotlist,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(save_dialog),

View File

@ -712,9 +712,9 @@ nsgtk_preferences_buttonAddTheme_clicked(GtkButton *button, struct ppref *priv)
fc = gtk_file_chooser_dialog_new(messages_get("gtkAddThemeTitle"),
GTK_WINDOW(priv->dialog),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_OK,
NSGTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL,
NSGTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
NULL);
len = SLEN("themes") + strlen(res_dir_location) + 1;

View File

@ -590,7 +590,7 @@ MULTIHANDLER(openfile)
scaf_current = g;
GtkWidget *dlgOpen = gtk_file_chooser_dialog_new("Open File",
scaf_current->window, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, -6, GTK_STOCK_OPEN, -5, NULL);
NSGTK_STOCK_CANCEL, -6, NSGTK_STOCK_OPEN, -5, NULL);
gint response = gtk_dialog_run(GTK_DIALOG(dlgOpen));
if (response == GTK_RESPONSE_OK) {
@ -624,8 +624,8 @@ MULTIHANDLER(savepage)
GtkWidget *fc = gtk_file_chooser_dialog_new(
messages_get("gtkcompleteSave"), g->window,
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
DIR *d;
char *path;
@ -720,8 +720,8 @@ MULTIHANDLER(pdf)
save_dialog = gtk_file_chooser_dialog_new("Export to PDF", g->window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(save_dialog),
@ -764,8 +764,8 @@ MULTIHANDLER(plaintext)
GtkWidget *fc = gtk_file_chooser_dialog_new(
messages_get("gtkplainSave"), g->window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
char *filename;
nserror res;
@ -2457,7 +2457,7 @@ gui_search_web_provider_update(const char *provider_name,
} else {
nsgtk_entry_set_icon_from_stock(current->webSearchEntry,
GTK_ENTRY_ICON_PRIMARY,
"gtk-find");
NSGTK_STOCK_FIND);
}
/* set search entry text */

View File

@ -961,18 +961,19 @@ sexy_icon_entry_add_clear_button(SexyIconEntry *icon_entry)
g_return_if_fail(icon_entry != NULL);
g_return_if_fail(SEXY_IS_ICON_ENTRY(icon_entry));
icon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
icon = nsgtk_image_new_from_stock(NSGTK_STOCK_CLEAR,
GTK_ICON_SIZE_MENU);
gtk_widget_show(icon);
sexy_icon_entry_set_icon(SEXY_ICON_ENTRY(icon_entry),
SEXY_ICON_ENTRY_SECONDARY,
GTK_IMAGE(icon));
SEXY_ICON_ENTRY_SECONDARY,
GTK_IMAGE(icon));
sexy_icon_entry_set_icon_highlight(SEXY_ICON_ENTRY(icon_entry),
SEXY_ICON_ENTRY_SECONDARY, TRUE);
SEXY_ICON_ENTRY_SECONDARY, TRUE);
if (icon_entry->priv->icon_released_id != 0)
{
g_signal_handler_disconnect(icon_entry,
icon_entry->priv->icon_released_id);
icon_entry->priv->icon_released_id);
}
icon_entry->priv->icon_released_id =

View File

@ -82,7 +82,8 @@ static GtkWidget *nsgtk_tab_label_setup(struct gui_window *window)
button = gtk_button_new();
close = gtk_image_new_from_stock("gtk-close", GTK_ICON_SIZE_MENU);
close = nsgtk_image_new_from_stock(NSGTK_STOCK_CLOSE,
GTK_ICON_SIZE_MENU);
gtk_container_add(GTK_CONTAINER(button), close);
gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE);
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@ -218,7 +219,7 @@ nsgtk_tab_add_newtab(GtkNotebook *notebook)
tablabel = nsgtk_hbox_new(FALSE, 1);
tabcontents = nsgtk_hbox_new(FALSE, 1);
add = gtk_image_new_from_stock("gtk-add", GTK_ICON_SIZE_MENU);
add = nsgtk_image_new_from_stock(NSGTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
gtk_box_pack_start(GTK_BOX(tablabel), add, FALSE, FALSE, 0);

View File

@ -260,7 +260,7 @@ void nsgtk_theme_add(const char *themename)
/* notification that theme was added successfully */
notification = gtk_dialog_new_with_buttons(messages_get("gtkThemeAdd"),
NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK,
NULL, GTK_DIALOG_DESTROY_WITH_PARENT, NSGTK_STOCK_OK,
GTK_RESPONSE_NONE, NULL);
if (notification == NULL) {
warn_user(messages_get("NoMemory"), 0);
@ -401,37 +401,37 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton, GtkIconSize iconsize)
#define BUTTON_IMAGE(p, q) \
case p##_BUTTON: \
image = GTK_IMAGE(gtk_image_new_from_stock(#q, iconsize)); \
image = GTK_IMAGE(nsgtk_image_new_from_stock(q, iconsize)); \
break
BUTTON_IMAGE(BACK, gtk-go-back);
BUTTON_IMAGE(FORWARD, gtk-go-forward);
BUTTON_IMAGE(STOP, gtk-stop);
BUTTON_IMAGE(RELOAD, gtk-refresh);
BUTTON_IMAGE(HOME, gtk-home);
BUTTON_IMAGE(NEWWINDOW, gtk-new);
BUTTON_IMAGE(NEWTAB, gtk-new);
BUTTON_IMAGE(OPENFILE, gtk-open);
BUTTON_IMAGE(CLOSETAB, gtk-close);
BUTTON_IMAGE(CLOSEWINDOW, gtk-close);
BUTTON_IMAGE(SAVEPAGE, gtk-save-as);
BUTTON_IMAGE(PRINTPREVIEW, gtk-print-preview);
BUTTON_IMAGE(PRINT, gtk-print);
BUTTON_IMAGE(QUIT, gtk-quit);
BUTTON_IMAGE(CUT, gtk-cut);
BUTTON_IMAGE(COPY, gtk-copy);
BUTTON_IMAGE(PASTE, gtk-paste);
BUTTON_IMAGE(DELETE, gtk-delete);
BUTTON_IMAGE(SELECTALL, gtk-select-all);
BUTTON_IMAGE(FIND, gtk-find);
BUTTON_IMAGE(PREFERENCES, gtk-preferences);
BUTTON_IMAGE(ZOOMPLUS, gtk-zoom-in);
BUTTON_IMAGE(ZOOMMINUS, gtk-zoom-out);
BUTTON_IMAGE(ZOOMNORMAL, gtk-zoom-100);
BUTTON_IMAGE(FULLSCREEN, gtk-fullscreen);
BUTTON_IMAGE(VIEWSOURCE, gtk-index);
BUTTON_IMAGE(CONTENTS, gtk-help);
BUTTON_IMAGE(ABOUT, gtk-about);
BUTTON_IMAGE(BACK, NSGTK_STOCK_GO_BACK);
BUTTON_IMAGE(FORWARD, NSGTK_STOCK_GO_FORWARD);
BUTTON_IMAGE(STOP, NSGTK_STOCK_STOP);
BUTTON_IMAGE(RELOAD, NSGTK_STOCK_REFRESH);
BUTTON_IMAGE(HOME, NSGTK_STOCK_HOME);
BUTTON_IMAGE(NEWWINDOW, "gtk-new");
BUTTON_IMAGE(NEWTAB, "gtk-new");
BUTTON_IMAGE(OPENFILE, NSGTK_STOCK_OPEN);
BUTTON_IMAGE(CLOSETAB, NSGTK_STOCK_CLOSE);
BUTTON_IMAGE(CLOSEWINDOW, NSGTK_STOCK_CLOSE);
BUTTON_IMAGE(SAVEPAGE, NSGTK_STOCK_SAVE_AS);
BUTTON_IMAGE(PRINTPREVIEW, "gtk-print-preview");
BUTTON_IMAGE(PRINT, "gtk-print");
BUTTON_IMAGE(QUIT, "gtk-quit");
BUTTON_IMAGE(CUT, "gtk-cut");
BUTTON_IMAGE(COPY, "gtk-copy");
BUTTON_IMAGE(PASTE, "gtk-paste");
BUTTON_IMAGE(DELETE, "gtk-delete");
BUTTON_IMAGE(SELECTALL, "gtk-select-all");
BUTTON_IMAGE(FIND, NSGTK_STOCK_FIND);
BUTTON_IMAGE(PREFERENCES, "gtk-preferences");
BUTTON_IMAGE(ZOOMPLUS, "gtk-zoom-in");
BUTTON_IMAGE(ZOOMMINUS, "gtk-zoom-out");
BUTTON_IMAGE(ZOOMNORMAL, "gtk-zoom-100");
BUTTON_IMAGE(FULLSCREEN, "gtk-fullscreen");
BUTTON_IMAGE(VIEWSOURCE, "gtk-index");
BUTTON_IMAGE(CONTENTS, "gtk-help");
BUTTON_IMAGE(ABOUT, "gtk-about");
#undef BUTTON_IMAGE
case HISTORY_BUTTON:
@ -481,12 +481,14 @@ nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
switch(tbbutton) {
case (SEARCH_BACK_BUTTON):
return GTK_IMAGE(gtk_image_new_from_stock("gtk-go-back", iconsize));
return GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_BACK,
iconsize));
case (SEARCH_FORWARD_BUTTON):
return GTK_IMAGE(gtk_image_new_from_stock("gtk-go-forward",
iconsize));
return GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_FORWARD,
iconsize));
case (SEARCH_CLOSE_BUTTON):
return GTK_IMAGE(gtk_image_new_from_stock("gtk-close", iconsize));
return GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_CLOSE,
iconsize));
default: {
size_t len = SLEN("themes/Alpha.png") +
strlen(res_dir_location) + 1;

View File

@ -687,7 +687,7 @@ GtkWidget *nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
#define MAKE_STOCKBUTTON(p, q) case p##_BUTTON: {\
GtkStockItem item;\
char *label = NULL;\
gtk_stock_lookup(#q, &item);\
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(\
@ -699,11 +699,11 @@ GtkWidget *nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
return w;\
}
MAKE_STOCKBUTTON(HOME, gtk-home)
MAKE_STOCKBUTTON(BACK, gtk-go-back)
MAKE_STOCKBUTTON(FORWARD, gtk-go-forward)
MAKE_STOCKBUTTON(STOP, gtk-stop)
MAKE_STOCKBUTTON(RELOAD, gtk-refresh)
MAKE_STOCKBUTTON(HOME, NSGTK_STOCK_HOME)
MAKE_STOCKBUTTON(BACK, NSGTK_STOCK_GO_BACK)
MAKE_STOCKBUTTON(FORWARD, NSGTK_STOCK_GO_FORWARD)
MAKE_STOCKBUTTON(STOP, NSGTK_STOCK_STOP)
MAKE_STOCKBUTTON(RELOAD, NSGTK_STOCK_REFRESH)
#undef MAKE_STOCKBUTTON
case HISTORY_BUTTON:
return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
@ -752,7 +752,7 @@ GtkWidget *nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
case WEBSEARCH_ITEM: {
if (edit_mode)
return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
gtk_image_new_from_stock("gtk-find",
nsgtk_image_new_from_stock(NSGTK_STOCK_FIND,
GTK_ICON_SIZE_LARGE_TOOLBAR)),
"[websearch]"));
@ -767,7 +767,8 @@ GtkWidget *nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY, "gtk-info");
nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY,
NSGTK_STOCK_INFO);
gtk_container_add(GTK_CONTAINER(w), entry);
return w;

View File

@ -164,8 +164,10 @@ static void nsgtk_viewdata_file_save(GtkWindow *parent, const char *filename,
/* inform user of faliure */
notif = gtk_dialog_new_with_buttons(messages_get("gtkSaveFailedTitle"),
parent,
GTK_DIALOG_MODAL, GTK_STOCK_OK,
GTK_RESPONSE_NONE, NULL);
GTK_DIALOG_MODAL,
NSGTK_STOCK_OK,
GTK_RESPONSE_NONE,
NULL);
g_signal_connect_swapped(notif, "response",
G_CALLBACK(gtk_widget_destroy), notif);
@ -185,9 +187,9 @@ gboolean nsgtk_on_viewdata_save_as_activate(GtkMenuItem *widget, gpointer g)
fc = gtk_file_chooser_dialog_new(messages_get("gtkSaveFile"),
nsg->window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
NSGTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE,
NSGTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT,
NULL);

View File

@ -1269,8 +1269,8 @@ gui_window_file_gadget_open(struct gui_window *g,
dialog = gtk_file_chooser_dialog_new("Select File",
nsgtk_scaffolding_window(g->scaffold),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NSGTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NSGTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
LOG(("*** open dialog: %p", dialog));