Kaydet (Commit) 8a172aef authored tarafından Christian Dywan's avatar Christian Dywan Kaydeden (comit) Jan Holesovsky

Clean up GtkSettings use in GTK+ platform module

üst 51940f50
...@@ -3260,6 +3260,12 @@ void printStyleColors( GtkStyle* pStyle ) ...@@ -3260,6 +3260,12 @@ void printStyleColors( GtkStyle* pStyle )
void GtkSalGraphics::updateSettings( AllSettings& rSettings ) void GtkSalGraphics::updateSettings( AllSettings& rSettings )
{ {
GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow );
gtk_widget_ensure_style( m_pWindow );
GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow );
StyleSettings aStyleSet = rSettings.GetStyleSettings();
// get the widgets in place // get the widgets in place
NWEnsureGTKMenu( m_nScreen ); NWEnsureGTKMenu( m_nScreen );
NWEnsureGTKMenubar( m_nScreen ); NWEnsureGTKMenubar( m_nScreen );
...@@ -3267,11 +3273,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -3267,11 +3273,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
NWEnsureGTKEditBox( m_nScreen ); NWEnsureGTKEditBox( m_nScreen );
NWEnsureGTKTooltip( m_nScreen ); NWEnsureGTKTooltip( m_nScreen );
gtk_widget_ensure_style( m_pWindow );
GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
StyleSettings aStyleSet = rSettings.GetStyleSettings();
#if OSL_DEBUG_LEVEL > 2 #if OSL_DEBUG_LEVEL > 2
printStyleColors( pStyle ); printStyleColors( pStyle );
#endif #endif
...@@ -3481,7 +3482,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -3481,7 +3482,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetFloatTitleFont( aFont ); aStyleSet.SetFloatTitleFont( aFont );
// get cursor blink time // get cursor blink time
GtkSettings *pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gEditBoxWidget );
gboolean blink = false; gboolean blink = false;
g_object_get( pSettings, "gtk-cursor-blink", &blink, (char *)NULL ); g_object_get( pSettings, "gtk-cursor-blink", &blink, (char *)NULL );
...@@ -3498,7 +3498,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -3498,7 +3498,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetCursorBlinkTime( STYLE_CURSOR_NOBLINKTIME ); aStyleSet.SetCursorBlinkTime( STYLE_CURSOR_NOBLINKTIME );
gboolean showmenuicons = true; gboolean showmenuicons = true;
pSettings = gtk_widget_get_settings( gWidgetData[m_nScreen].gImageMenuItem );
g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL ); g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL );
aStyleSet.SetPreferredUseImagesInMenus( showmenuicons ); aStyleSet.SetPreferredUseImagesInMenus( showmenuicons );
...@@ -3519,45 +3518,29 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -3519,45 +3518,29 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// preferred icon style // preferred icon style
gchar* pIconThemeName = NULL; gchar* pIconThemeName = NULL;
g_object_get( gtk_settings_get_default(), "gtk-icon-theme-name", &pIconThemeName, (char *)NULL ); g_object_get( pSettings, "gtk-icon-theme-name", &pIconThemeName, (char *)NULL );
aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) ); aStyleSet.SetPreferredSymbolsStyleName( OUString::createFromAscii( pIconThemeName ) );
g_free( pIconThemeName ); g_free( pIconThemeName );
aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE ); aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_LARGE );
const cairo_font_options_t* pNewOptions = NULL; const cairo_font_options_t* pNewOptions = NULL;
if( GdkScreen* pScreen = gdk_display_get_screen( gdk_display_get_default(), m_nScreen ) )
{
#if !GTK_CHECK_VERSION(2,9,0) #if !GTK_CHECK_VERSION(2,9,0)
static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) = static cairo_font_options_t* (*gdk_screen_get_font_options)(GdkScreen*) =
(cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" ); (cairo_font_options_t*(*)(GdkScreen*))osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_font_options" );
if( gdk_screen_get_font_options != NULL ) if( gdk_screen_get_font_options != NULL )
#endif #endif
pNewOptions = gdk_screen_get_font_options( pScreen ); pNewOptions = gdk_screen_get_font_options( pScreen );
}
aStyleSet.SetCairoFontOptions( pNewOptions ); aStyleSet.SetCairoFontOptions( pNewOptions );
// finally update the collected settings // finally update the collected settings
rSettings.SetStyleSettings( aStyleSet ); rSettings.SetStyleSettings( aStyleSet );
gchar* pThemeName = NULL;
g_object_get( pSettings, "gtk-theme-name", &pThemeName, (char *)NULL );
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
{ std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName );
GtkSettings* pGtkSettings = gtk_settings_get_default();
GValue aValue;
memset( &aValue, 0, sizeof(GValue) );
g_value_init( &aValue, G_TYPE_STRING );
g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue );
const gchar* pThemeName = g_value_get_string( &aValue );
std::fprintf( stderr, "Theme name is \"%s\"\n", pThemeName );
g_value_unset( &aValue );
}
#endif #endif
GtkSettings* pGtkSettings = gtk_settings_get_default();
GValue aValue;
memset( &aValue, 0, sizeof(GValue) );
g_value_init( &aValue, G_TYPE_STRING );
g_object_get_property( G_OBJECT(pGtkSettings), "gtk-theme-name", &aValue );
const gchar* pThemeName = g_value_get_string( &aValue );
// default behaviour // default behaviour
bNeedPixmapPaint = bGlobalNeedPixmapPaint; bNeedPixmapPaint = bGlobalNeedPixmapPaint;
...@@ -3582,7 +3565,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -3582,7 +3565,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
} }
} }
// clean up // clean up
g_value_unset( &aValue ); g_free (pThemeName);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment