[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (1.1.2.20070818-163-gf3de6fd)
The branch, master has been updated
via f3de6fdfcd78b60d201e8786c78ea59bcc3f437e (commit)
from f024b92045527776c0ddf86ac16de5dfb09837ad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gschem/include/prototype.h | 1 +
gschem/src/gschem.c | 3 +++
gschem/src/x_window.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit f3de6fdfcd78b60d201e8786c78ea59bcc3f437e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Fri Dec 21 23:48:42 2007 +0000
gschem: Set default window icon to the "gschem" icon from the icon theme.
When a "gschem" icon is found in the icon theme, this will be used as the
default application icon. For GTK versions < 2.6, some default sizes have
been picked at which to look for icons. GTK >= 2.6 will find the best icon
by name.
:100644 100644 78a085c... 4f22de4... M gschem/include/prototype.h
:100644 100644 be96edf... e337242... M gschem/src/gschem.c
:100644 100644 b2c4079... f0b83a1... M gschem/src/x_window.c
=========
Changes
=========
commit f3de6fdfcd78b60d201e8786c78ea59bcc3f437e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Fri Dec 21 23:48:42 2007 +0000
gschem: Set default window icon to the "gschem" icon from the icon theme.
When a "gschem" icon is found in the icon theme, this will be used as the
default application icon. For GTK versions < 2.6, some default sizes have
been picked at which to look for icons. GTK >= 2.6 will find the best icon
by name.
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 78a085c..4f22de4 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -849,3 +849,4 @@ PAGE *x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename);
void x_window_set_current_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
gint x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filename);
void x_window_close_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
+void x_window_set_default_icon (void);
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index be96edf..e337242 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -261,6 +261,9 @@ void main_prog(void *closure, int argc, char *argv[])
recent_files_load();
gschem_atexit(recent_files_save, NULL);
+ /* Set default icon */
+ x_window_set_default_icon();
+
/* At end, complete set up of window. */
colormap = gdk_colormap_get_system ();
x_window_setup_colors();
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index b2c4079..f0b83a1 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -32,6 +32,9 @@
#include <dmalloc.h>
#endif
+#define GSCHEM_THEME_ICON_NAME "gschem"
+#define GSCHEM_ICON_SIZES 16, 22, 48
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
@@ -1027,3 +1030,44 @@ x_window_close_page (GSCHEM_TOPLEVEL *w_current, PAGE *page)
x_window_set_current_page (w_current, new_current);
}
}
+
+
+/*! \brief Setup default icon for GTK windows
+ *
+ * \par Function Description
+ * Sets the default window icon by name, to be found in the current icon
+ * theme. The name used is #defined above as GSCHEM_THEME_ICON_NAME.
+ *
+ * For GTK versions < 2.6, we have to load the icons explicitly, and pass
+ * them to GTK. As we don't know what size is appropriate, a #define above,
+ * GSCHEM_ICON_SIZES is used to list (comma separated) the sizes we have
+ * icons for. Icons loaded at all of these sizes are passed to GTK.
+ */
+void x_window_set_default_icon( void )
+{
+#if GTK_CHECK_VERSION (2,6,0)
+ gtk_window_set_default_icon_name( GSCHEM_THEME_ICON_NAME );
+#else
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *icon;
+ GList *icon_list = NULL;
+ int icon_size[] = { GSCHEM_ICON_SIZES };
+ int i;
+
+ for ( i = 0; i < sizeof( icon_size ) / sizeof( *icon_size ); i++ ) {
+ icon_theme = gtk_icon_theme_get_default();
+ icon = gtk_icon_theme_load_icon( icon_theme,
+ GSCHEM_THEME_ICON_NAME,
+ icon_size[i],
+ 0, /* flags */
+ NULL /* **error */ );
+ if (icon != NULL)
+ icon_list = g_list_append( icon_list, icon );
+ }
+
+ gtk_window_set_default_icon_list( icon_list );
+
+ g_list_foreach( icon_list, (GFunc) g_object_unref, NULL );
+ g_list_free( icon_list );
+#endif
+}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs