[easytag/wip/application-window: 54/70] Convert XPM image data to PNG



commit 79590c2a363a7d96019997c8c6de589a2fdd5481
Author: David King <amigadave amigadave com>
Date:   Mon Jul 14 08:56:03 2014 +0100

    Convert XPM image data to PNG
    
    Build PNG images into the easytag binary with GResource.

 Makefile.am                                  |   32 ++--
 TODO                                         |    1 -
 data/images/all-lowercase.png                |  Bin 0 -> 275 bytes
 data/images/all-uppercase.png                |  Bin 0 -> 287 bytes
 data/images/artist-album.png                 |  Bin 0 -> 1444 bytes
 data/images/artist.png                       |  Bin 0 -> 1118 bytes
 data/images/first-letter-uppercase-word.png  |  Bin 0 -> 290 bytes
 data/images/first-letter-uppercase.png       |  Bin 0 -> 292 bytes
 data/images/freedb.png                       |  Bin 0 -> 555 bytes
 data/images/gnudb.png                        |  Bin 0 -> 595 bytes
 data/images/invert-selection.png             |  Bin 0 -> 307 bytes
 data/images/mask.png                         |  Bin 0 -> 789 bytes
 data/images/musicbrainz.png                  |  Bin 0 -> 418 bytes
 data/images/red-lines.png                    |  Bin 0 -> 295 bytes
 data/images/sequence-track.png               |  Bin 0 -> 278 bytes
 data/images/unselect-all.png                 |  Bin 0 -> 274 bytes
 data/org.gnome.EasyTAG.gresource.xml         |   14 +
 data/pixmaps/all_downcase.xpm                |   25 --
 data/pixmaps/all_uppercase.xpm               |   25 --
 data/pixmaps/artist.xpm                      |  220 ----------------
 data/pixmaps/artist_album.xpm                |  348 --------------------------
 data/pixmaps/first_letter_uppercase.xpm      |   25 --
 data/pixmaps/first_letter_uppercase_word.xpm |   25 --
 data/pixmaps/freedb.xpm                      |   86 -------
 data/pixmaps/gnudb.xpm                       |   91 -------
 data/pixmaps/invert_selection.xpm            |   27 --
 data/pixmaps/mask.xpm                        |  123 ---------
 data/pixmaps/musicbrainz.xpm                 |   36 ---
 data/pixmaps/red_lines.xpm                   |   25 --
 data/pixmaps/sequence_track.xpm              |   10 -
 data/pixmaps/unselect_all.xpm                |   25 --
 data/toolbar.ui                              |    4 +-
 src/application_window.c                     |   26 ++-
 src/browser.c                                |   11 +-
 src/cddb_dialog.c                            |   50 +++--
 src/easytag.c                                |    1 -
 src/load_files_dialog.c                      |    3 +-
 src/misc.c                                   |  120 ---------
 src/misc.h                                   |    8 -
 src/scan_dialog.c                            |    5 +-
 40 files changed, 89 insertions(+), 1277 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 69cd36d..b88893c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -271,21 +271,21 @@ doc/easytag.1: doc/easytag.xml Makefile
 nodist_man_MANS = doc/easytag.1
 endif
 
-pixmaps = \
-       data/pixmaps/all_downcase.xpm \
-       data/pixmaps/all_uppercase.xpm \
-       data/pixmaps/artist.xpm \
-       data/pixmaps/artist_album.xpm \
-       data/pixmaps/first_letter_uppercase.xpm \
-       data/pixmaps/first_letter_uppercase_word.xpm \
-       data/pixmaps/freedb.xpm \
-       data/pixmaps/gnudb.xpm \
-       data/pixmaps/invert_selection.xpm \
-       data/pixmaps/mask.xpm \
-       data/pixmaps/musicbrainz.xpm \
-       data/pixmaps/red_lines.xpm \
-       data/pixmaps/sequence_track.xpm \
-       data/pixmaps/unselect_all.xpm
+images = \
+       data/images/all-lowercase.png \
+       data/images/all-uppercase.png \
+       data/images/artist.png \
+       data/images/artist-album.png \
+       data/images/first-letter-uppercase.png \
+       data/images/first-letter-uppercase-word.png \
+       data/images/freedb.png \
+       data/images/gnudb.png \
+       data/images/invert-selection.png \
+       data/images/mask.png \
+       data/images/musicbrainz.png \
+       data/images/red-lines.png \
+       data/images/sequence-track.png \
+       data/images/unselect-all.png
 
 iconthemedir = $(datadir)/icons/hicolor
 
@@ -348,7 +348,7 @@ dist_noinst_DATA = \
        data/icons/win32/easytag.ico \
        data/nsis/easytag-header.bmp \
        data/nsis/easytag-sidebar.bmp \
-       $(pixmaps) \
+       $(images) \
        doc/easytag.xml \
        COPYING.GPL3 \
        easytag-win32-installer.nsi.in \
diff --git a/TODO b/TODO
index f7b5fca..02caecd 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ TODO List
 General tidying
 ---------------
 
-* Use PNG icons and drop the XPM ones
 * Use GProxyResolver for proxy settings
 * Port file I/O to use GFile from GIO
 ** Additionally, make I/O asynchronous
diff --git a/data/images/all-lowercase.png b/data/images/all-lowercase.png
new file mode 100644
index 0000000..e076e3f
Binary files /dev/null and b/data/images/all-lowercase.png differ
diff --git a/data/images/all-uppercase.png b/data/images/all-uppercase.png
new file mode 100644
index 0000000..7ca2c1b
Binary files /dev/null and b/data/images/all-uppercase.png differ
diff --git a/data/images/artist-album.png b/data/images/artist-album.png
new file mode 100644
index 0000000..a45b624
Binary files /dev/null and b/data/images/artist-album.png differ
diff --git a/data/images/artist.png b/data/images/artist.png
new file mode 100644
index 0000000..7c298a3
Binary files /dev/null and b/data/images/artist.png differ
diff --git a/data/images/first-letter-uppercase-word.png b/data/images/first-letter-uppercase-word.png
new file mode 100644
index 0000000..4329f95
Binary files /dev/null and b/data/images/first-letter-uppercase-word.png differ
diff --git a/data/images/first-letter-uppercase.png b/data/images/first-letter-uppercase.png
new file mode 100644
index 0000000..a2f7058
Binary files /dev/null and b/data/images/first-letter-uppercase.png differ
diff --git a/data/images/freedb.png b/data/images/freedb.png
new file mode 100644
index 0000000..8194b6e
Binary files /dev/null and b/data/images/freedb.png differ
diff --git a/data/images/gnudb.png b/data/images/gnudb.png
new file mode 100644
index 0000000..ca8a1ac
Binary files /dev/null and b/data/images/gnudb.png differ
diff --git a/data/images/invert-selection.png b/data/images/invert-selection.png
new file mode 100644
index 0000000..f9df227
Binary files /dev/null and b/data/images/invert-selection.png differ
diff --git a/data/images/mask.png b/data/images/mask.png
new file mode 100644
index 0000000..9ab0d81
Binary files /dev/null and b/data/images/mask.png differ
diff --git a/data/images/musicbrainz.png b/data/images/musicbrainz.png
new file mode 100644
index 0000000..41d1223
Binary files /dev/null and b/data/images/musicbrainz.png differ
diff --git a/data/images/red-lines.png b/data/images/red-lines.png
new file mode 100644
index 0000000..e5bfafd
Binary files /dev/null and b/data/images/red-lines.png differ
diff --git a/data/images/sequence-track.png b/data/images/sequence-track.png
new file mode 100644
index 0000000..49ae3b8
Binary files /dev/null and b/data/images/sequence-track.png differ
diff --git a/data/images/unselect-all.png b/data/images/unselect-all.png
new file mode 100644
index 0000000..2bdcb16
Binary files /dev/null and b/data/images/unselect-all.png differ
diff --git a/data/org.gnome.EasyTAG.gresource.xml b/data/org.gnome.EasyTAG.gresource.xml
index f9a0494..f68ec89 100644
--- a/data/org.gnome.EasyTAG.gresource.xml
+++ b/data/org.gnome.EasyTAG.gresource.xml
@@ -3,5 +3,19 @@
     <gresource prefix='/org/gnome/EasyTAG'>
         <file preprocess='xml-stripblanks'>menus.ui</file>
         <file preprocess='xml-stripblanks'>toolbar.ui</file>
+        <file preprocess='to-pixdata'>images/all-lowercase.png</file>
+        <file preprocess='to-pixdata'>images/all-uppercase.png</file>
+        <file preprocess='to-pixdata'>images/artist-album.png</file>
+        <file preprocess='to-pixdata'>images/artist.png</file>
+        <file preprocess='to-pixdata'>images/first-letter-uppercase.png</file>
+        <file preprocess='to-pixdata'>images/first-letter-uppercase-word.png</file>
+        <file preprocess='to-pixdata'>images/freedb.png</file>
+        <file preprocess='to-pixdata'>images/gnudb.png</file>
+        <file preprocess='to-pixdata'>images/invert-selection.png</file>
+        <file preprocess='to-pixdata'>images/mask.png</file>
+        <file preprocess='to-pixdata'>images/musicbrainz.png</file>
+        <file preprocess='to-pixdata'>images/red-lines.png</file>
+        <file preprocess='to-pixdata'>images/sequence-track.png</file>
+        <file preprocess='to-pixdata'>images/unselect-all.png</file>
     </gresource>
 </gresources>
diff --git a/data/toolbar.ui b/data/toolbar.ui
index 51a5daf..a6b9a55 100644
--- a/data/toolbar.ui
+++ b/data/toolbar.ui
@@ -106,7 +106,7 @@
                 <property name="action-name">win.file-artist-view</property>
                 <property name="action-target">'artist'</property>
                 <property name="label" translatable="yes">Artist and Album</property>
-                <property name="stock-id">easytag-artist-album</property>
+                <!--<property name="icon-widget">artist_view_image</property>-->
                 <property name="tooltip-text" translatable="yes">View by artist and album</property>
                 <property name="visible">True</property>
             </object>
@@ -118,7 +118,7 @@
             <object class="GtkToolButton" id="invert_selection_button">
                 <property name="action-name">win.invert-selection</property>
                 <property name="label" translatable="yes">Invert File Selection</property>
-                <property name="stock-id">easytag-invert-selection</property>
+                <!--<property name="stock-id">easytag-invert-selection</property>-->
                 <property name="tooltip-text" translatable="yes">Invert file selection</property>
                 <property name="visible">True</property>
             </object>
diff --git a/src/application_window.c b/src/application_window.c
index 7b7d9e9..471eeaa 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -284,8 +284,7 @@ Attach_Popup_Menu_To_Tag_Entries (GtkEntry *entry)
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
 
     menu_item = gtk_image_menu_item_new_with_label (_("All uppercase"));
-    image = gtk_image_new_from_stock ("easytag-all-uppercase",
-                                      GTK_ICON_SIZE_MENU);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/all-uppercase.png");
     gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
     g_signal_connect_swapped (menu_item, "activate",
@@ -293,8 +292,7 @@ Attach_Popup_Menu_To_Tag_Entries (GtkEntry *entry)
                               G_OBJECT (entry));
 
     menu_item = gtk_image_menu_item_new_with_label (_("All lowercase"));
-    image = gtk_image_new_from_stock ("easytag-all-downcase",
-                                      GTK_ICON_SIZE_MENU);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/all-lowercase.png");
     gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
     g_signal_connect_swapped (menu_item, "activate",
@@ -302,8 +300,7 @@ Attach_Popup_Menu_To_Tag_Entries (GtkEntry *entry)
                               G_OBJECT (entry));
 
     menu_item = gtk_image_menu_item_new_with_label (_("First letter uppercase"));
-    image = gtk_image_new_from_stock ("easytag-first-letter-uppercase",
-                                      GTK_ICON_SIZE_MENU);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/first-letter-uppercase.png");
     gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
     g_signal_connect_swapped (menu_item, "activate",
@@ -311,8 +308,7 @@ Attach_Popup_Menu_To_Tag_Entries (GtkEntry *entry)
                               G_OBJECT (entry));
 
     menu_item = gtk_image_menu_item_new_with_label (_("First letter uppercase of each word"));
-    image = gtk_image_new_from_stock ("easytag-first-letter-uppercase-word",
-                                      GTK_ICON_SIZE_MENU);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/first-letter-uppercase-word.png");
     gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
     g_signal_connect_swapped (menu_item, "activate",
@@ -1071,7 +1067,6 @@ create_file_area (void)
     return FileFrame;
 }
 
-#include "data/pixmaps/sequence_track.xpm"
 static GtkWidget *
 create_tag_area (EtApplicationWindow *self)
 {
@@ -1265,7 +1260,7 @@ create_tag_area (EtApplicationWindow *self)
                                  _("Number selected tracks sequentially. "
                                    "Starts at 01 in each subdirectory."));
     /* Pixmap into priv->track_sequence_button button. */
-    image = Create_Xpm_Image ((const char **)sequence_track_xpm);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/sequence-track.png");
     gtk_container_add (GTK_CONTAINER (priv->track_sequence_button), image);
     gtk_widget_set_can_default (priv->track_sequence_button, TRUE);
     gtk_widget_set_can_focus (priv->track_sequence_button, FALSE);
@@ -1312,7 +1307,7 @@ create_tag_area (EtApplicationWindow *self)
     gtk_widget_set_tooltip_text (priv->track_number_button,
                                  _("Set the number of files, in the same directory of the displayed file, to 
the selected tracks."));
     /* Pixmap into priv->track_number_button button. */
-    image = Create_Xpm_Image ((const char **)sequence_track_xpm);
+    image = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/sequence-track.png");
     gtk_container_add (GTK_CONTAINER (priv->track_number_button), image);
     gtk_widget_set_can_default (priv->track_number_button, TRUE);
     gtk_widget_set_can_focus (priv->track_number_button, FALSE);
@@ -3005,6 +3000,7 @@ et_application_window_init (EtApplicationWindow *self)
         GtkBuilder *builder;
         GError *error = NULL;
         GtkWidget *toolbar;
+        GtkToolButton *button;
 
         builder = gtk_builder_new ();
         gtk_builder_add_from_resource (builder,
@@ -3020,6 +3016,14 @@ et_application_window_init (EtApplicationWindow *self)
         toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "main_toolbar"));
         gtk_box_pack_start (GTK_BOX (main_vbox), toolbar, FALSE, FALSE, 0);
 
+        /* TODO: Use resource property on GtkImage when using GTK+ > 3.8. */
+        button = GTK_TOOL_BUTTON (gtk_builder_get_object (builder, "artist_view_button"));
+        gtk_tool_button_set_icon_widget (button,
+                                         gtk_image_new_from_resource 
("/org/gnome/EasyTAG/images/artist.png"));
+        button = GTK_TOOL_BUTTON (gtk_builder_get_object (builder, "invert_selection_button"));
+        gtk_tool_button_set_icon_widget (button,
+                                         gtk_image_new_from_resource 
("/org/gnome/EasyTAG/images/invert-selection.png"));
+
         g_object_unref (builder);
     }
 
diff --git a/src/browser.c b/src/browser.c
index 3f72e72..059042e 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -2353,6 +2353,7 @@ Browser_Artist_List_Load_Files (EtBrowser *self, ET_File *etfile_to_select)
     for (l = ETCore->ETArtistAlbumFileList; l != NULL; l = g_list_next (l))
     {
         gint   nbr_files = 0;
+        GdkPixbuf* pixbuf;
 
         // Insert a line for each artist
         AlbumList = (GList *)l->data;
@@ -2367,8 +2368,10 @@ Browser_Artist_List_Load_Files (EtBrowser *self, ET_File *etfile_to_select)
         }
 
         /* Add the new row. */
+        pixbuf = gdk_pixbuf_new_from_resource ("/org/gnome/EasyTAG/images/artist.png",
+                                               NULL);
         gtk_list_store_insert_with_values (priv->artist_model, &iter, G_MAXINT,
-                                           ARTIST_PIXBUF, "easytag-artist",
+                                           ARTIST_PIXBUF, pixbuf,
                                            ARTIST_NAME, artistname,
                                            ARTIST_NUM_ALBUMS,
                                            g_list_length (g_list_first (AlbumList)),
@@ -2376,6 +2379,8 @@ Browser_Artist_List_Load_Files (EtBrowser *self, ET_File *etfile_to_select)
                                            ARTIST_ALBUM_LIST_POINTER,
                                            AlbumList, -1);
 
+        g_object_unref (pixbuf);
+
         // Todo: Use something better than string comparison
         if ( (!artistname && !artist_to_select)
         ||   (artistname  &&  artist_to_select && strcmp(artistname,artist_to_select) == 0) )
@@ -3777,7 +3782,7 @@ create_browser (EtBrowser *self)
                                    GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
 
     priv->artist_model = gtk_list_store_new (ARTIST_COLUMN_COUNT,
-                                             G_TYPE_STRING, // Stock-id
+                                             GDK_TYPE_PIXBUF,
                                              G_TYPE_STRING,
                                              G_TYPE_UINT,
                                              G_TYPE_UINT,
@@ -3800,7 +3805,7 @@ create_browser (EtBrowser *self)
     renderer = gtk_cell_renderer_pixbuf_new();
     gtk_tree_view_column_pack_start(column, renderer, FALSE);
     gtk_tree_view_column_set_attributes(column, renderer,
-                                       "stock-id",        ARTIST_PIXBUF,
+                                        "pixbuf", ARTIST_PIXBUF,
                                         NULL);
     renderer = gtk_cell_renderer_text_new();
     gtk_tree_view_column_pack_start(column, renderer, FALSE);
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index c715297..02f16bf 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -2979,7 +2979,10 @@ create_cddb_dialog (EtCDDBDialog *self)
                                 _("Request automatically the CDDB using the selected files (the order is 
important) to generate the CddbID"));
 
     // Button to stop the search
-    priv->stop_auto_search_button = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
+    priv->stop_auto_search_button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (priv->stop_auto_search_button),
+                       gtk_image_new_from_icon_name ("process-stop",
+                                                     GTK_ICON_SIZE_BUTTON));
     gtk_box_pack_start(GTK_BOX(hbox),priv->stop_auto_search_button,FALSE,FALSE,0);
     gtk_button_set_relief(GTK_BUTTON(priv->stop_auto_search_button),GTK_RELIEF_NONE);
     gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
@@ -3054,7 +3057,10 @@ create_cddb_dialog (EtCDDBDialog *self)
                               self);
 
     /* Button to stop the search. */
-    priv->stop_search_button = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
+    priv->stop_search_button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (priv->stop_search_button),
+                       gtk_image_new_from_icon_name ("process-stop",
+                                                     GTK_ICON_SIZE_BUTTON));
     gtk_box_pack_start(GTK_BOX(hbox),priv->stop_search_button,FALSE,FALSE,0);
     gtk_button_set_relief(GTK_BUTTON(priv->stop_search_button),GTK_RELIEF_NONE);
     gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
@@ -3252,14 +3258,20 @@ create_cddb_dialog (EtCDDBDialog *self)
 
     gtk_entry_set_text (GTK_ENTRY (priv->search_string_in_results_entry), "");
 
-    Button = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_DOWN,NULL);
+    Button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (Button),
+                       gtk_image_new_from_icon_name ("go-down",
+                                                     GTK_ICON_SIZE_BUTTON));
     gtk_box_pack_start(GTK_BOX(hbox),Button,FALSE,FALSE,0);
     gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
     g_signal_connect_swapped (Button, "clicked",
                               G_CALLBACK (find_next_string_in_results), self);
     gtk_widget_set_tooltip_text(Button,_("Search Next"));
 
-    Button = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_UP,NULL);
+    Button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (Button),
+                       gtk_image_new_from_icon_name ("go-down",
+                                                     GTK_ICON_SIZE_BUTTON));
     gtk_box_pack_start (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
     gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
     g_signal_connect_swapped (Button, "clicked",
@@ -3272,7 +3284,7 @@ create_cddb_dialog (EtCDDBDialog *self)
     gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
 
     priv->display_red_lines_toggle = gtk_toggle_button_new();
-    Icon = gtk_image_new_from_stock("easytag-red-lines", GTK_ICON_SIZE_BUTTON);
+    Icon = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/red-lines.png");
     gtk_container_add(GTK_CONTAINER(priv->display_red_lines_toggle),Icon);
     gtk_box_pack_start(GTK_BOX(hbox),priv->display_red_lines_toggle,FALSE,FALSE,0);
     gtk_button_set_relief(GTK_BUTTON(priv->display_red_lines_toggle),GTK_RELIEF_NONE);
@@ -3281,15 +3293,18 @@ create_cddb_dialog (EtCDDBDialog *self)
                               G_CALLBACK (Cddb_Display_Red_Lines_In_Result),
                               self);
 
-    Button = Create_Button_With_Icon_And_Label ("easytag-unselect-all", NULL);
+    Icon = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/unselect-all.png");
+    Button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (Button), Icon);
     gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
     gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
     gtk_widget_set_tooltip_text (Button, _("Unselect all lines"));
     g_signal_connect_swapped (Button, "clicked",
                               G_CALLBACK (track_list_unselect_all), self);
 
-    Button = Create_Button_With_Icon_And_Label ("easytag-invert-selection",
-                                                NULL);
+    Icon = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/invert-selection.png");
+    Button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (Button), Icon);
     gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
     gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
     gtk_widget_set_tooltip_text (Button, _("Invert lines selection"));
@@ -3299,8 +3314,8 @@ create_cddb_dialog (EtCDDBDialog *self)
 
     Button = gtk_button_new ();
     gtk_container_add (GTK_CONTAINER (Button),
-                       gtk_image_new_from_stock (GTK_STOCK_SELECT_ALL,
-                                                 GTK_ICON_SIZE_BUTTON));
+                       gtk_image_new_from_icon_name ("edit-select-all",
+                                                     GTK_ICON_SIZE_BUTTON));
     gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
     gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
     gtk_widget_set_tooltip_text (Button, _("Select all lines"));
@@ -4208,12 +4223,6 @@ Cddb_Get_Id3_Genre_From_Cddb_Genre (const gchar *cddb_genre)
     return cddb_genre;
 }
 
-/* Pixmaps */
-#include "data/pixmaps/freedb.xpm"
-#include "data/pixmaps/gnudb.xpm"
-#include "data/pixmaps/musicbrainz.xpm"
-/*#include "data/pixmaps/closed_folder.xpm"*/
-
 /*
  * Returns the pixmap to display following the server name
  */
@@ -4223,11 +4232,14 @@ Cddb_Get_Pixbuf_From_Server_Name (const gchar *server_name)
     g_return_val_if_fail (server_name != NULL, NULL);
 
     if (strstr (server_name, "freedb.org"))
-        return gdk_pixbuf_new_from_xpm_data(freedb_xpm);
+        return gdk_pixbuf_new_from_resource ("/org/gnome/EasyTAG/images/freedb.png",
+                                             NULL);
     else if (strstr(server_name,"gnudb.org"))
-        return gdk_pixbuf_new_from_xpm_data(gnudb_xpm);
+        return gdk_pixbuf_new_from_resource ("/org/gnome/EasyTAG/images/gnudb.png",
+                                             NULL);
     else if (strstr(server_name,"musicbrainz.org"))
-        return gdk_pixbuf_new_from_xpm_data(musicbrainz_xpm);
+        return gdk_pixbuf_new_from_resource ("/org/gnome/EasyTAG/images/musicbrainz.png",
+                                             NULL);
     else
         return NULL;
 }
diff --git a/src/easytag.c b/src/easytag.c
index 475c251..4eb66b4 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -124,7 +124,6 @@ common_init (GApplication *application)
     /* Initialization */
     ET_Core_Create();
     Main_Stop_Button_Pressed = FALSE;
-    Init_Custom_Icons();
     Init_Mouse_Cursor();
     TrackEntryComboModel = NULL;
     GenreComboModel      = NULL;
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 5a47522..1cb659f 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -878,8 +878,7 @@ create_load_files_dialog (EtLoadFilesDialog *self)
     g_signal_connect_swapped(G_OBJECT(Button),"clicked", G_CALLBACK(File_Selection_Window_For_File), 
G_OBJECT(gtk_bin_get_child(GTK_BIN(priv->file_to_load_combo))));
     // Button 'load'
     // the signal attached to this button, to load the file, is placed after the 
priv->load_file_content_view definition
-    ButtonLoad = Create_Button_With_Icon_And_Label(GTK_STOCK_REVERT_TO_SAVED,_(" Load "));
-    //ButtonLoad = gtk_button_new_with_label(_(" Load "));
+    ButtonLoad = gtk_button_new_with_label (_("Load"));
     gtk_box_pack_start(GTK_BOX(hbox),ButtonLoad,FALSE,FALSE,0);
     g_signal_connect_swapped(G_OBJECT(gtk_bin_get_child(GTK_BIN(priv->file_to_load_combo))),"changed", 
G_CALLBACK(set_load_button_sensitivity), G_OBJECT(ButtonLoad));
 
diff --git a/src/misc.c b/src/misc.c
index 95792cb..60a990e 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -53,9 +53,6 @@ static GdkCursor *MouseCursor;
 /**************
  * Prototypes *
  **************/
-static void Create_Xpm_Icon_Factory (const char **xpm_data,
-                                     const char *name_in_factory);
-
 /* Browser */
 static void Open_File_Selection_Window (GtkWidget *entry, gchar *title, GtkFileChooserAction action);
 void        File_Selection_Window_For_File      (GtkWidget *entry);
@@ -71,42 +68,6 @@ void        File_Selection_Window_For_Directory (GtkWidget *entry);
  ******************************/
 
 /*
- * Return a button with an icon and a label
- */
-GtkWidget *Create_Button_With_Icon_And_Label (const gchar *pixmap_name, gchar *label)
-{
-    GtkWidget *Button;
-    GtkWidget *HBox;
-    GtkWidget *Label;
-    GtkWidget *Pixmap;
-
-    Button = gtk_button_new();
-    HBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
-    gtk_container_add(GTK_CONTAINER(Button),HBox);
-
-    /* Add a pixmap if not null */
-    if (pixmap_name != NULL)
-    {
-        gtk_widget_realize(MainWindow);
-        Pixmap = gtk_image_new_from_stock(pixmap_name, GTK_ICON_SIZE_BUTTON);
-        gtk_container_add(GTK_CONTAINER(HBox),Pixmap);
-    }
-
-    /* Add a label if not null */
-    if (label != NULL)
-    {
-        Label = gtk_label_new(label);
-        gtk_container_add(GTK_CONTAINER(HBox),Label);
-    }
-
-    /* Display a warning message if the both parameters are NULL */
-    if (pixmap_name==NULL && label==NULL)
-        g_warning("Empty button created 'adr=%p' (no icon and no label)!",Button);
-
-    return Button;
-}
-
-/*
  * Add the 'string' passed in parameter to the list store
  * If this string already exists in the list store, it doesn't add it.
  * Returns TRUE if string was added.
@@ -419,87 +380,6 @@ void Set_Unbusy_Cursor (void)
     Destroy_Mouse_Cursor();
 }
 
-
-
-/*
- * Add easytag specific icons to GTK stock set
- */
-#include "data/pixmaps/all_uppercase.xpm"
-#include "data/pixmaps/all_downcase.xpm"
-#include "data/pixmaps/artist.xpm"
-#include "data/pixmaps/artist_album.xpm"
-//#include "data/pixmaps/blackwhite.xpm"
-#include "data/pixmaps/first_letter_uppercase.xpm"
-#include "data/pixmaps/first_letter_uppercase_word.xpm"
-#include "data/pixmaps/invert_selection.xpm"
-#include "data/pixmaps/mask.xpm"
-#include "data/pixmaps/red_lines.xpm"
-//#include "data/pixmaps/sequence_track.xpm"
-#include "data/pixmaps/unselect_all.xpm"
-void Init_Custom_Icons (void)
-{
-    Create_Xpm_Icon_Factory((const char**)artist_xpm,               "easytag-artist");
-    Create_Xpm_Icon_Factory((const char**)invert_selection_xpm,     "easytag-invert-selection");
-    Create_Xpm_Icon_Factory((const char**)unselect_all_xpm,         "easytag-unselect-all");
-    Create_Xpm_Icon_Factory((const char**)mask_xpm,                 "easytag-mask");
-    //Create_Xpm_Icon_Factory((const char**)blackwhite_xpm,         "easytag-blackwhite");
-    //Create_Xpm_Icon_Factory((const char**)sequence_track_xpm,     "easytag-sequence-track");
-    Create_Xpm_Icon_Factory((const char**)red_lines_xpm,            "easytag-red-lines");
-    Create_Xpm_Icon_Factory((const char**)artist_album_xpm,     "easytag-artist-album");
-    Create_Xpm_Icon_Factory((const char**)all_uppercase_xpm,        "easytag-all-uppercase");
-    Create_Xpm_Icon_Factory((const char**)all_downcase_xpm,         "easytag-all-downcase");
-    Create_Xpm_Icon_Factory((const char**)first_letter_uppercase_xpm,       
"easytag-first-letter-uppercase");
-    Create_Xpm_Icon_Factory((const char**)first_letter_uppercase_word_xpm,  
"easytag-first-letter-uppercase-word");
-}
-
-
-/*
- * Create an icon factory from the specified pixmap
- * Also add it to the GTK stock images
- */
-static void
-Create_Xpm_Icon_Factory (const char **xpm_data, const char *name_in_factory)
-{
-    GtkIconSet      *icon;
-    GtkIconFactory  *factory;
-    GdkPixbuf       *pixbuf;
-
-    if (!*xpm_data || !name_in_factory)
-        return;
-
-    pixbuf = gdk_pixbuf_new_from_xpm_data(xpm_data);
-
-    if (pixbuf)
-    {
-        icon = gtk_icon_set_new_from_pixbuf(pixbuf);
-        g_object_unref(G_OBJECT(pixbuf));
-
-        factory = gtk_icon_factory_new();
-        gtk_icon_factory_add(factory, name_in_factory, icon);
-        gtk_icon_set_unref(icon);
-        gtk_icon_factory_add_default(factory);
-    }
-}
-
-/*
- * Return a widget with a pixmap
- * Note: for pixmap 'pixmap.xpm', pixmap_name is 'pixmap_xpm'
- */
-GtkWidget *Create_Xpm_Image (const char **xpm_name)
-{
-    GdkPixbuf *pixbuf;
-    GtkWidget *image;
-
-    g_return_val_if_fail (*xpm_name != NULL, NULL);
-
-    pixbuf = gdk_pixbuf_new_from_xpm_data(xpm_name);
-    image = gtk_image_new_from_pixbuf(GDK_PIXBUF(pixbuf));
-
-    return image;
-}
-
-
-
 /*
  * Iter compare func: Sort alphabetically
  */
diff --git a/src/misc.h b/src/misc.h
index bf1200e..e067a21 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -31,13 +31,6 @@ G_BEGIN_DECLS
  **************/
 
 /*
- * Create Pixmaps, buttons...
- */
-GtkWidget *Create_Button_With_Icon_And_Label (const gchar *pixmap_name, gchar *label);
-GtkWidget *Create_Xpm_Image                  (const char **xpm_name);
-
-
-/*
  * Combobox misc functions
  */
 gboolean Add_String_To_Combo_List(GtkListStore *liststore, const gchar *string);
@@ -52,7 +45,6 @@ gboolean Parse_Date (void);
 void Load_Genres_List_To_UI (void);
 void Load_Track_List_To_UI  (void);
 void Init_Character_Translation_Table (void);
-void Init_Custom_Icons (void);
 gchar *Check_If_Executable_Exists (const gchar *program);
 
 // Mouse cursor
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index 01a5192..dbe1880 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -2566,7 +2566,7 @@ create_scan_dialog (EtScanDialog *self)
 
     /* Mask Editor button */
     priv->mask_editor_toggle = gtk_toggle_button_new();
-    Icon = gtk_image_new_from_stock("easytag-mask", GTK_ICON_SIZE_BUTTON);
+    Icon = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/mask.png");
     gtk_container_add(GTK_CONTAINER(priv->mask_editor_toggle),Icon);
     gtk_box_pack_start(GTK_BOX(HBox1),priv->mask_editor_toggle,FALSE,FALSE,0);
     gtk_button_set_relief(GTK_BUTTON(priv->mask_editor_toggle),GTK_RELIEF_NONE);
@@ -2805,8 +2805,7 @@ create_scan_dialog (EtScanDialog *self)
                               G_CALLBACK (Select_Fields_Invert_Selection),
                               self);
     gtk_box_pack_end (GTK_BOX(hbox), Button, FALSE, FALSE, 0);
-    Icon = gtk_image_new_from_stock ("easytag-invert-selection",
-                                     GTK_ICON_SIZE_BUTTON);
+    Icon = gtk_image_new_from_resource ("/org/gnome/EasyTAG/images/invert-selection.png");
     gtk_container_add(GTK_CONTAINER(Button),Icon);
     gtk_widget_set_tooltip_text (Button, _("Invert selection"));
     Button = gtk_button_new();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]