summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2014-01-02 17:34:58 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2014-01-02 17:34:58 +0000
commitc862d2996b29dcace346d6c2e746672fd9d1949d (patch)
tree57f451ad381bb67b10a2b3e21419278a9c0c1400 /src/widgets
parentmemory leak fix (doc_title) + code readability (diff)
downloadinkscape-c862d2996b29dcace346d6c2e746672fd9d1949d.tar.gz
inkscape-c862d2996b29dcace346d6c2e746672fd9d1949d.zip
Fix Gtk+ 3.10 warnings: GtkStockItem is deprecated
(bzr r12868)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/calligraphy-toolbar.cpp2
-rw-r--r--src/widgets/desktop-widget.cpp6
-rw-r--r--src/widgets/gradient-selector.cpp23
-rw-r--r--src/widgets/icon.cpp53
-rw-r--r--src/widgets/paintbucket-toolbar.cpp2
-rw-r--r--src/widgets/pencil-toolbar.cpp2
-rw-r--r--src/widgets/spiral-toolbar.cpp2
-rw-r--r--src/widgets/star-toolbar.cpp2
-rw-r--r--src/widgets/text-toolbar.cpp12
9 files changed, 48 insertions, 56 deletions
diff --git a/src/widgets/calligraphy-toolbar.cpp b/src/widgets/calligraphy-toolbar.cpp
index 9f08d3462..73484d1b5 100644
--- a/src/widgets/calligraphy-toolbar.cpp
+++ b/src/widgets/calligraphy-toolbar.cpp
@@ -638,7 +638,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
InkAction* inky = ink_action_new( "ProfileEditAction",
_("Add/Edit Profile"),
_("Add or edit calligraphic profile"),
- GTK_STOCK_PROPERTIES,
+ INKSCAPE_ICON("document-properties"),
Inkscape::ICON_SIZE_DECORATION );
g_object_set( inky, "short_label", _("Edit"), NULL );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_ddc_edit_profile), (GObject*)holder );
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 7e254cdcd..e5568787b 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -1123,8 +1123,8 @@ SPDesktopWidget::shutdown()
gtk_widget_show(close_button);
gtk_dialog_add_action_widget(GTK_DIALOG(dialog), close_button, GTK_RESPONSE_NO);
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, GTK_RESPONSE_YES);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Save"), GTK_RESPONSE_YES);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
gint response;
@@ -1185,7 +1185,7 @@ SPDesktopWidget::shutdown()
gtk_widget_show(save_button);
gtk_dialog_add_action_widget(GTK_DIALOG(dialog), close_button, GTK_RESPONSE_NO);
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
gtk_dialog_add_action_widget(GTK_DIALOG(dialog), save_button, GTK_RESPONSE_YES);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 5ac994509..871d1ee4c 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -36,6 +36,7 @@
#include "paint-selector.h"
#include "style.h"
#include "id-clash.h"
+#include "ui/icon-names.h"
enum {
GRABBED,
@@ -196,8 +197,13 @@ static void sp_gradient_selector_init(SPGradientSelector *sel)
//sel->nonsolid.push_back(hb);
gtk_box_pack_start( GTK_BOX(sel), hb, FALSE, FALSE, 0 );
+#if GTK_CHECK_VERSION(3,10,0)
+ sel->add = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+#else
sel->add = gtk_button_new ();
- gtk_button_set_image(GTK_BUTTON(sel->add), gtk_image_new_from_stock ( GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR ) );
+ GtkWidget *img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-add"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_image(GTK_BUTTON(sel->add), img);
+#endif
sel->nonsolid.push_back(sel->add);
gtk_box_pack_start (GTK_BOX (hb), sel->add, FALSE, FALSE, 0);
@@ -207,8 +213,14 @@ static void sp_gradient_selector_init(SPGradientSelector *sel)
gtk_button_set_relief(GTK_BUTTON(sel->add), GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text( sel->add, _("Create a duplicate gradient"));
+ // FIXME: Probably better to either use something from the icon naming spec or ship our own "edit-gradient" icon
+#if GTK_CHECK_VERSION(3,10,0)
+ sel->edit = gtk_button_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+#else
sel->edit = gtk_button_new ();
- gtk_button_set_image(GTK_BUTTON(sel->edit), gtk_image_new_from_stock ( GTK_STOCK_EDIT, GTK_ICON_SIZE_SMALL_TOOLBAR ) );
+ img = gtk_image_new_from_icon_name(INKSCAPE_ICON("gtk-edit"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_image(GTK_BUTTON(sel->edit), img);
+#endif
sel->nonsolid.push_back(sel->edit);
gtk_box_pack_start (GTK_BOX (hb), sel->edit, FALSE, FALSE, 0);
@@ -217,8 +229,13 @@ static void sp_gradient_selector_init(SPGradientSelector *sel)
gtk_button_set_relief(GTK_BUTTON(sel->edit), GTK_RELIEF_NONE);
gtk_widget_set_tooltip_text( sel->edit, _("Edit gradient"));
+#if GTK_CHECK_VERSION(3,10,0)
+ sel->del = gtk_button_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+#else
sel->del = gtk_button_new ();
- gtk_button_set_image(GTK_BUTTON(sel->del), gtk_image_new_from_stock ( GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR ) );
+ img = gtk_image_new_from_icon_name(INKSCAPE_ICON("list-remove"), GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_button_set_image(GTK_BUTTON(sel->del), img);
+#endif
sel->swatch_widgets.push_back(sel->del);
gtk_box_pack_start (GTK_BOX (hb), sel->del, FALSE, FALSE, 0);
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index feb69cc64..6f558c84a 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -45,6 +45,7 @@
#include "util/units.h"
#include "icon.h"
+#include "ui/icon-names.h"
struct IconImpl {
static GtkWidget *newFull( Inkscape::IconSize lsize, gchar const *name );
@@ -790,44 +791,20 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name )
}
GtkIconSize mappedSize = iconSizeLookup[trySize];
- GtkStockItem stock;
- gboolean stockFound = gtk_stock_lookup( name, &stock );
-
- GtkWidget *img = 0;
if ( legacyNames.empty() ) {
setupLegacyNaming();
}
- if ( stockFound ) {
- img = gtk_image_new_from_stock( name, mappedSize );
- } else {
- img = gtk_image_new_from_icon_name( name, mappedSize );
- if ( dump ) {
- g_message("gtk_image_new_from_icon_name( '%s', %d ) = %p", name, mappedSize, img);
- GtkImageType thing = gtk_image_get_storage_type(GTK_IMAGE(img));
- g_message(" Type is %d %s", (int)thing, (thing == GTK_IMAGE_EMPTY ? "Empty" : "ok"));
- }
+ GtkWidget *img = gtk_image_new_from_icon_name( name, mappedSize );
+ if ( dump ) {
+ g_message("gtk_image_new_from_icon_name( '%s', %d ) = %p", name, mappedSize, img);
+ GtkImageType thing = gtk_image_get_storage_type(GTK_IMAGE(img));
+ g_message(" Type is %d %s", (int)thing, (thing == GTK_IMAGE_EMPTY ? "Empty" : "ok"));
}
if ( img ) {
GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) );
- if ( type == GTK_IMAGE_STOCK ) {
- if ( !stockFound ) {
- // It's not showing as a stock ID, so assume it will be present internally
- addPreRender( mappedSize, name );
-
- // Add a hook to render if set visible before prerender is done.
- g_signal_connect( G_OBJECT(img), "map", G_CALLBACK(imageMapCB), GINT_TO_POINTER(static_cast<int>(mappedSize)) );
- if ( dump ) {
- g_message(" connecting %p for imageMapCB for [%s] %d", img, name, (int)mappedSize);
- }
- }
- widget = GTK_WIDGET(img);
- img = 0;
- if ( dump ) {
- g_message( "loaded gtk '%s' %d (GTK_IMAGE_STOCK) %s on %p", name, mappedSize, (stockFound ? "STOCK" : "local"), widget );
- }
- } else if ( type == GTK_IMAGE_ICON_NAME ) {
+ if ( type == GTK_IMAGE_ICON_NAME ) {
widget = GTK_WIDGET(img);
img = 0;
@@ -842,7 +819,7 @@ GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name )
}
} else {
if ( dump ) {
- g_message( "skipped gtk '%s' %d (not GTK_IMAGE_STOCK)", name, lsize );
+ g_message( "skipped gtk '%s' %d (not GTK_IMAGE_ICON_NAME)", name, lsize );
}
//g_object_unref(G_OBJECT(img));
img = 0;
@@ -1033,7 +1010,7 @@ int IconImpl::getPhysSize(int size)
// "The rendered pixbuf may not even correspond to the width/height returned by
// gtk_icon_size_lookup(), because themes are free to render the pixbuf however
// they like, including changing the usual size."
- gchar const *id = GTK_STOCK_OPEN;
+ gchar const *id = INKSCAPE_ICON("document-open");
GdkPixbuf *pb = gtk_widget_render_icon( icon, id, gtkSizes[i], NULL);
if (pb) {
width = gdk_pixbuf_get_width(pb);
@@ -1334,9 +1311,9 @@ guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names,
static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, unsigned psize) {
static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk");
- GtkStockItem stock;
- gboolean stockFound = gtk_stock_lookup( name, &stock );
- if ( !stockFound ) {
+ Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
+ bool icon_found = icon_theme->has_icon(name);
+ if ( !icon_found ) {
Gtk::IconTheme::add_builtin_icon( name, psize, Glib::wrap(pb) );
if (dump) {
g_message(" set in a builtin for %s:%d:%d", name, lsize, psize);
@@ -1346,10 +1323,8 @@ static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, un
void Inkscape::queueIconPrerender( Glib::ustring const &name, Inkscape::IconSize lsize )
{
- GtkStockItem stock;
- gboolean stockFound = gtk_stock_lookup( name.c_str(), &stock );
gboolean themedFound = gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str());
- if (!stockFound && !themedFound ) {
+ if ( !themedFound ) {
gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
if ( !sizeMapDone ) {
IconImpl::injectCustomSize();
@@ -1617,7 +1592,7 @@ void IconImpl::imageMapCB(GtkWidget* widget, gpointer user_data)
{
gchar* id = 0;
GtkIconSize size = GTK_ICON_SIZE_INVALID;
- gtk_image_get_stock(GTK_IMAGE(widget), &id, &size);
+ gtk_image_get_icon_name(GTK_IMAGE(widget), &id, &size);
GtkIconSize lsize = static_cast<GtkIconSize>(GPOINTER_TO_INT(user_data));
if ( id ) {
int psize = getPhysSize(lsize);
diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp
index 8c4de2b32..a9962b209 100644
--- a/src/widgets/paintbucket-toolbar.cpp
+++ b/src/widgets/paintbucket-toolbar.cpp
@@ -232,7 +232,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
GtkAction* act = gtk_action_new( "PaintbucketResetAction",
_("Defaults"),
_("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- GTK_STOCK_CLEAR );
+ INKSCAPE_ICON("edit-clear"));
g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(paintbucket_defaults), holder );
gtk_action_group_add_action( mainActions, act );
gtk_action_set_sensitive( act, TRUE );
diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp
index 36f2912e9..e8296f735 100644
--- a/src/widgets/pencil-toolbar.cpp
+++ b/src/widgets/pencil-toolbar.cpp
@@ -321,7 +321,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
InkAction* inky = ink_action_new( "PencilResetAction",
_("Defaults"),
_("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- GTK_STOCK_CLEAR,
+ INKSCAPE_ICON("edit-clear"),
Inkscape::ICON_SIZE_SMALL_TOOLBAR );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_pencil_tb_defaults), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp
index 7fc6d1b34..b95c1c41e 100644
--- a/src/widgets/spiral-toolbar.cpp
+++ b/src/widgets/spiral-toolbar.cpp
@@ -299,7 +299,7 @@ void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
InkAction* inky = ink_action_new( "SpiralResetAction",
_("Defaults"),
_("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- GTK_STOCK_CLEAR,
+ INKSCAPE_ICON("edit-clear"),
secondarySize );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_spl_tb_defaults), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp
index bac0271db..1691a9b25 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -571,7 +571,7 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
GtkAction* act = gtk_action_new( "StarResetAction",
_("Defaults"),
_("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- GTK_STOCK_CLEAR );
+ INKSCAPE_ICON("edit-clear"));
g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_stb_defaults), holder );
gtk_action_group_add_action( mainActions, act );
gtk_action_set_sensitive( act, TRUE );
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 750fa1de6..6d5d54871 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -1348,7 +1348,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_list_store_set( model, &iter,
0, _("Align left"),
1, _("Align left"),
- 2, GTK_STOCK_JUSTIFY_LEFT,
+ 2, INKSCAPE_ICON("format-justify-left"),
3, true,
-1 );
@@ -1356,7 +1356,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_list_store_set( model, &iter,
0, _("Align center"),
1, _("Align center"),
- 2, GTK_STOCK_JUSTIFY_CENTER,
+ 2, INKSCAPE_ICON("format-justify-center"),
3, true,
-1 );
@@ -1364,7 +1364,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_list_store_set( model, &iter,
0, _("Align right"),
1, _("Align right"),
- 2, GTK_STOCK_JUSTIFY_RIGHT,
+ 2, INKSCAPE_ICON("format-justify-right"),
3, true,
-1 );
@@ -1372,14 +1372,14 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_list_store_set( model, &iter,
0, _("Justify"),
1, _("Justify (only flowed text)"),
- 2, GTK_STOCK_JUSTIFY_FILL,
+ 2, INKSCAPE_ICON("format-justify-fill"),
3, false,
-1 );
EgeSelectOneAction* act = ege_select_one_action_new( "TextAlignAction", // Name
_("Alignment"), // Label
_("Text alignment"), // Tooltip
- NULL, // StockID
+ NULL, // Icon name
GTK_TREE_MODEL(model) ); // Model
g_object_set( act, "short_label", "NotUsed", NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
@@ -1420,7 +1420,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
EgeSelectOneAction* act = ege_select_one_action_new( "TextOrientationAction", // Name
_("Orientation"), // Label
_("Text orientation"), // Tooltip
- NULL, // StockID
+ NULL, // Icon name
GTK_TREE_MODEL(model) ); // Model
g_object_set( act, "short_label", "NotUsed", NULL );