Mercurial > geeqie
diff src/main.c @ 289:6a7298988a7a
Simplify and unify gtk_window creation with the help of
the new window_new() function, that wraps gtk_window_new()
call.
Subclass, title and icon are set in the same call.
author | zas_ |
---|---|
date | Wed, 09 Apr 2008 16:37:54 +0000 |
parents | d1f74154463e |
children | b16b9b8979e5 |
line wrap: on
line diff
--- a/src/main.c Wed Apr 09 13:53:01 2008 +0000 +++ b/src/main.c Wed Apr 09 16:37:54 2008 +0000 @@ -52,6 +52,34 @@ *----------------------------------------------------------------------------- */ +GtkWidget *window_new(GtkWindowType type, const gchar *name, const gchar *icon, + const gchar *icon_file, const gchar *subtitle) +{ + gchar *title; + GtkWidget *window; + + window = gtk_window_new(type); + if (!window) return NULL; + + if (subtitle) + { + title = g_strdup_printf("%s - %s", subtitle, GQ_APPNAME); + } + else + { + title = g_strdup_printf("%s", GQ_APPNAME); + } + + gtk_window_set_title(GTK_WINDOW(window), title); + g_free(title); + + window_set_icon(window, icon, icon_file); + gtk_window_set_role(GTK_WINDOW(window), name); + gtk_window_set_wmclass(GTK_WINDOW(window), name, GQ_WMCLASS); + + return window; +} + void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file) { if (!icon && !file) icon = PIXBUF_INLINE_ICON;