[solang] Improved icon usage
- From: Debarshi Ray <debarshir src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [solang] Improved icon usage
- Date: Thu, 4 Feb 2010 00:35:21 +0000 (UTC)
commit 18ba175f30482f89b2ae63365750bded7543e1b0
Author: Debarshi Ray <rishi gnu org>
Date: Wed Feb 3 03:18:24 2010 +0200
Improved icon usage
+ Specified a default icon for all windows using
Gtk::Window::set_default_icon_name.
+ Set the window icons from the icon theme instead of manually
creating them from hardcoded file names.
src/application/application.cpp | 2 +
src/application/main-window.cpp | 53 +-------------------------------------
src/application/main.cpp | 6 ++++
3 files changed, 10 insertions(+), 51 deletions(-)
---
diff --git a/src/application/application.cpp b/src/application/application.cpp
index 72635a6..7fbf7eb 100644
--- a/src/application/application.cpp
+++ b/src/application/application.cpp
@@ -407,6 +407,8 @@ Application::add_icons() throw()
iconFactory_->add(Gtk::StockID(PACKAGE_TARNAME"-slideshow-play"),
icon_set_slideshow_play);
iconFactory_->add_default();
+
+ Gtk::Window::set_default_icon_name(PACKAGE_TARNAME);
}
void
diff --git a/src/application/main-window.cpp b/src/application/main-window.cpp
index afeab81..d8e7eb3 100644
--- a/src/application/main-window.cpp
+++ b/src/application/main-window.cpp
@@ -39,18 +39,10 @@ static const std::string artistsFile = PACKAGE_DOC_DIR"/ARTISTS";
static const std::string authorsFile = PACKAGE_DOC_DIR"/AUTHORS";
static const std::string copyingFile = PACKAGE_DOC_DIR"/COPYING";
-static const std::string iconFile
- = PACKAGE_DATA_DIR"/icons/hicolor/22x22/apps/"
- PACKAGE_TARNAME".png";
-
static const std::string layoutFile
= PACKAGE_DATA_DIR"/"PACKAGE_TARNAME"/"
PACKAGE_TARNAME"-layout.xml";
-static const std::string logoFile
- = PACKAGE_DATA_DIR"/icons/hicolor/96x96/apps/"
- PACKAGE_TARNAME".png";
-
static const std::string uiFile
= PACKAGE_DATA_DIR"/"PACKAGE_TARNAME"/ui/"PACKAGE_TARNAME".ui";
@@ -219,28 +211,7 @@ MainWindow::MainWindow() throw() :
dockObjectsLeftBottom_(),
dockObjectsCenter_()
{
- PixbufPtr icon;
-
- try
- {
- icon = Gdk::Pixbuf::create_from_file(iconFile);
- }
- catch (const Glib::FileError & e)
- {
- g_warning("%s", e.what().c_str());
- return;
- }
- catch (const Gdk::PixbufError & e)
- {
- g_warning("%s", e.what().c_str());
- return;
- }
-
- if (0 != icon)
- {
- set_icon(icon);
- }
-
+ set_icon_name(PACKAGE_TARNAME);
set_title("Solang");
set_default_size(800, 600);
add(vBox_);
@@ -643,27 +614,7 @@ MainWindow::on_action_help_about() throw()
about_dialog.set_license(license);
}
- PixbufPtr logo;
-
- try
- {
- logo = Gdk::Pixbuf::create_from_file(logoFile);
- }
- catch (const Glib::FileError & e)
- {
- g_warning("%s", e.what().c_str());
- return;
- }
- catch (const Gdk::PixbufError & e)
- {
- g_warning("%s", e.what().c_str());
- return;
- }
-
- if (0 != logo)
- {
- about_dialog.set_logo(logo);
- }
+ about_dialog.set_logo_icon_name(PACKAGE_TARNAME);
// Translators: Put your names here.
about_dialog.set_translator_credits(_("translator-credits"));
diff --git a/src/application/main.cpp b/src/application/main.cpp
index cb05998..47af29d 100644
--- a/src/application/main.cpp
+++ b/src/application/main.cpp
@@ -33,6 +33,7 @@
#endif // ENABLE_NLS
#include "application.h"
+#include "types.h"
int
main(int argc, char *argv[])
@@ -48,6 +49,11 @@ main(int argc, char *argv[])
Glib::set_application_name(_(PACKAGE_NAME));
Gtk::Main kit(argc, argv, true);
+
+ const Solang::IconThemePtr icon_theme = Gtk::IconTheme::get_default();
+ icon_theme->append_search_path(
+ PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "icons");
+
Solang::Application application(argc, argv);
application.init();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]