[gparted] Add fallback method for specifying GParted icon (#695279)



commit b09d6035cdca90debb145628b0c62a0213ee1225
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Wed Apr 24 17:50:53 2013 +0100

    Add fallback method for specifying GParted icon (#695279)
    
    On RHEL / CentOS 5.9 GParted couldn't set an icon as the
    set_default_icon_name() method is not available.  See commit [1] for
    details.
    
    Re-add the old set_icon_from_file() method as a fallback and re-install
    a GParted pixmap as was used before commit [2].
    
    Commit [1]:
        a04210788399736ff7f097cb75650ebcbd0a4950
        Only use Gtk::Window::set_default_icon_name method when available
    
    Commit [2]:
        f5a80bc9048ffa859aab40de27d96a5dd1d7f65b
        Enabled GParted to use themed app icon (Tango theme)
    
    Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9

 data/icons/Makefile.am |   22 ++++++++++++++++++++--
 src/Makefile.am        |    1 +
 src/Win_GParted.cc     |    6 ++++--
 3 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 40ea846..01f9b89 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -16,12 +16,23 @@ public_icons = \
 private_icons = \
        $(NULL)
 
+# Name of the fallback icon to install in /usr/share/pixmaps [1]
+# --
+# The GNOME 2 desktop wants a 16x16 "Menu" type icon [2] for the title
+# bar and the open window list, and a 32x32 icon for the Alt-Tab task
+# switcher.  GParted only specifies a single icon file in the fallback
+# case so just use the 16x16 one and let it be scaled as required.
+# [1] https://developer.gnome.org/icon-theme-spec/
+# [2] https://developer.gnome.org/hig-book/2.32/hig-book.html#icons
+pixmap = hicolor_apps_16x16_gparted.png
+
 noinst_DATA = \
        $(NULL)
 
 EXTRA_DIST = \
        $(public_icons)         \
        $(private_icons)        \
+       $(pixmap)               \
        $(noinst_DATA)          \
        $(NULL)
 
@@ -76,6 +87,13 @@ uninstall-icons:
                rm -f $(DESTDIR)$(pkgdatadir)/icons/$$THEME/$$SIZE/$$CONTEXT/$$ICONFILE; \
        done
 
-install-data-local: install-icons update-icon-cache
+install-pixmap:
+       mkdir -p $(DESTDIR)$(datadir)/pixmaps; \
+       $(INSTALL_DATA) $(srcdir)/$(pixmap) $(DESTDIR)$(datadir)/pixmaps/gparted.png
+
+uninstall-pixmap:
+       rm -f $(DESTDIR)$(datadir)/pixmaps/gparted.png
+
+install-data-local: install-icons install-pixmap update-icon-cache
 
-uninstall-local: uninstall-icons update-icon-cache
+uninstall-local: uninstall-icons uninstall-pixmap update-icon-cache
diff --git a/src/Makefile.am b/src/Makefile.am
index 34c6de4..313f895 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,7 @@ INCLUDES =                                              \
        $(GTHREAD_CFLAGS)                               \
        $(GTKMM_CFLAGS)                                 \
        -DGPARTED_DATADIR=\""$(datadir)"\"                      \
+       -DGNOME_ICONDIR=\""$(datadir)/pixmaps"\"                \
        -DGNOMELOCALEDIR=\""$(datadir)/locale"\"
 
 AM_CFLAGS = -Wall      
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index f8a3418..4201e21 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -75,16 +75,18 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
        this ->set_title( _("GParted") );
        this ->set_default_size( 775, 500 );
        
-#ifdef HAVE_SET_DEFAULT_ICON_NAME
        try
        {
+#ifdef HAVE_SET_DEFAULT_ICON_NAME
                this ->set_default_icon_name( "gparted" ) ;
+#else
+               this ->set_icon_from_file( GNOME_ICONDIR "/gparted.png" ) ;
+#endif
        }
        catch ( Glib::Exception & e )
        {
                std::cout << e .what() << std::endl ;
        }
-#endif
        
        //Pack the main box
        this ->add( vbox_main ); 


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