Use 'midori' icon and update icon cache in waf

This commit is contained in:
Christian Dywan 2008-05-31 14:20:36 +02:00
parent 3ea30bfd4e
commit f00522ac27
3 changed files with 33 additions and 7 deletions

View file

@ -1,14 +1,13 @@
[Desktop Entry] [Desktop Entry]
Version=1.0 Version=1.0
Encoding=UTF-8 Encoding=UTF-8
Type=Application Type=Application
_Name=Midori Web Browser _Name=Midori
_GenericName=Web Browser _GenericName=Web Browser
_Comment=Lightweight web browser _Comment=Lightweight web browser
Categories=GTK;Network; Categories=GTK;Network;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml; MimeType=text/html;text/xml;application/xhtml+xml;application/xml;
Exec=midori %u Exec=midori %u
Icon=web-browser Icon=midori
Terminal=false Terminal=false
StartupNotify=true StartupNotify=true

View file

@ -2312,7 +2312,7 @@ midori_browser_destroy_cb (MidoriBrowser* browser)
// Destroy tabs first, so widgets can still see window elements on destroy // Destroy tabs first, so widgets can still see window elements on destroy
gtk_container_foreach (GTK_CONTAINER (priv->notebook), gtk_container_foreach (GTK_CONTAINER (priv->notebook),
G_CALLBACK (gtk_widget_destroy), NULL); (GtkCallback) gtk_widget_destroy, NULL);
} }
static const gchar* ui_markup = static const gchar* ui_markup =
@ -2435,6 +2435,20 @@ static const gchar* ui_markup =
"</popup>" "</popup>"
"</ui>"; "</ui>";
static void
midori_browser_realize_cb (GtkStyle* style, MidoriBrowser* browser)
{
GdkScreen* screen = gtk_widget_get_screen (GTK_WIDGET (browser));
if (screen)
{
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
if (gtk_icon_theme_has_icon (icon_theme, "midori"))
gtk_window_set_icon_name (GTK_WINDOW (browser), "midori");
else
gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser");
}
}
static void static void
midori_browser_init (MidoriBrowser* browser) midori_browser_init (MidoriBrowser* browser)
{ {
@ -2443,13 +2457,14 @@ midori_browser_init (MidoriBrowser* browser)
MidoriBrowserPrivate* priv = browser->priv; MidoriBrowserPrivate* priv = browser->priv;
// Setup the window metrics // Setup the window metrics
g_signal_connect (browser, "realize",
G_CALLBACK (midori_browser_realize_cb), browser);
g_signal_connect (browser, "window-state-event", g_signal_connect (browser, "window-state-event",
G_CALLBACK (midori_browser_window_state_event_cb), NULL); G_CALLBACK (midori_browser_window_state_event_cb), NULL);
g_signal_connect (browser, "size-allocate", g_signal_connect (browser, "size-allocate",
G_CALLBACK (midori_browser_size_allocate_cb), NULL); G_CALLBACK (midori_browser_size_allocate_cb), NULL);
g_signal_connect (browser, "destroy", g_signal_connect (browser, "destroy",
G_CALLBACK (midori_browser_destroy_cb), NULL); G_CALLBACK (midori_browser_destroy_cb), NULL);
// FIXME: Use custom program icon
gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser"); gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser");
gtk_window_set_title (GTK_WINDOW (browser), g_get_application_name ()); gtk_window_set_title (GTK_WINDOW (browser), g_get_application_name ());
GtkWidget* vbox = gtk_vbox_new (FALSE, 0); GtkWidget* vbox = gtk_vbox_new (FALSE, 0);

16
wscript
View file

@ -2,7 +2,8 @@
# WAF build script for midori # WAF build script for midori
import Params import Params
import subprocess import pproc as subprocess
import Common
APPNAME = 'midori' APPNAME = 'midori'
VERSION = '0.0.18' VERSION = '0.0.18'
@ -58,7 +59,7 @@ def configure (conf):
conf.define ('SOKOKE_DEBUG_', '-') conf.define ('SOKOKE_DEBUG_', '-')
conf.write_config_header ('config.h') conf.write_config_header ('config.h')
def set_options(opt): def set_options (opt):
opt.tool_options ('compiler_cc') opt.tool_options ('compiler_cc')
opt.tool_options ('intltool') opt.tool_options ('intltool')
@ -82,3 +83,14 @@ def build (bld):
Params.pprint ('BLUE', "File midori.desktop not generated") Params.pprint ('BLUE', "File midori.desktop not generated")
if bld.env ()['INTLTOOL']: if bld.env ()['INTLTOOL']:
install_files ('DATADIR', 'applications', 'midori.desktop') install_files ('DATADIR', 'applications', 'midori.desktop')
def shutdown ():
dir = Common.path_install('DATADIR', 'icons/hicolor')
if Params.g_commands['install']:
if not Params.g_options.destdir:
# update the pixmap cache directory
Params.pprint('YELLOW', "Updating Gtk icon cache.")
subprocess.call (['gtk-update-icon-cache', '-q', '-f', '-t', dir])
else:
Params.pprint('YELLOW', "Icon cache not updated. After install, run this:")
Params.pprint('YELLOW', "gtk-update-icon-cache -q -f -t %s" % dir)