代码之家  ›  专栏  ›  技术社区  ›  Claudiu

将GTK更新到最新版本使应用程序看起来很难看

  •  1
  • Claudiu  · 技术社区  · 13 年前

    我预先安装了GTK 2.14.6,通过python 2.5和pygtk2.12使用它。我刚下载了GTK 2.22包并提取了它,替换了旧的包。(我没有将它提取到旧文件夹上,只是移动了旧文件夹并将新包提取到了相同的位置)。然而,同一个应用程序从看起来非常像本机Windows7应用程序到看起来非常难看、笨重。更像是一个WindowsXP主题,但它甚至没有很好地模仿。

    GTK主题化如何工作?如何获得最新版本的GTK(由于不稳定问题而更新),但有主题?为什么旧版本比新版本看起来更好?

    1 回复  |  直到 13 年前
        1
  •  3
  •   Matthew Talbert    13 年前

    在您的发行版中,在etc/gtk-2.0/gtkrc中,您需要确保“样式”设置为“MSW默认值”,并且引擎设置为“WIMP”。这是我的整个GTKRC,只是为了确保你拥有它:

    gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32"
    gtk-toolbar-icon-size = small-toolbar
    
    # disable images in buttons. i've only seen ugly delphi apps use this feature.
    gtk-button-images = 1
    
    # enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly.
    # the office apps use them heavily, though.
    gtk-menu-images = 1
    
    # use the win32 button ordering instead of the GNOME HIG one, where applicable
    gtk-alternative-button-order = 1
    
    # use the win32 sort indicators direction, as in Explorer
    gtk-alternative-sort-arrows = 1
    
    # Windows users don't expect the PC Speaker beeping at them when they backspace in an empty textview and stuff like that
    gtk-error-bell = 0
    
    style "msw-default"
    {
      GtkWidget::interior-focus = 1
      GtkOptionMenu::indicator-size = { 9, 5 }
      GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 }
      GtkSpinButton::shadow-type = in
    
      # Owen and I disagree that these should be themable
      GtkUIManager::add-tearoffs = 0
      #GtkComboBox::add-tearoffs = 0
    
      GtkComboBox::appears-as-list = 1
      GtkComboBox::focus-on-click = 0
    
      GOComboBox::add_tearoffs = 0
    
      GtkTreeView::allow-rules = 0
      GtkTreeView::expander-size = 12
    
      GtkExpander::expander-size = 12
    
      GtkScrolledWindow::scrollbar_spacing = 1
    
      GtkSeparatorMenuItem::horizontal-padding = 2
    
      engine "wimp" 
      {
      }
    
     }
    class "*" style "msw-default"
    
    binding "ms-windows-tree-view"
    {
      bind "Right" { "expand-collapse-cursor-row" (1,1,0) }
      bind "Left" { "expand-collapse-cursor-row" (1,0,0) }
    }
    
    class "GtkTreeView" binding "ms-windows-tree-view"
    
    style "msw-combobox-thickness" = "msw-default"
    {
      xthickness = 0 
      ythickness = 0
    }
    
    
    widget_class "*TreeView*ComboBox*" style "msw-combobox-thickness"
    widget_class "*ComboBox*GtkFrame*" style "msw-combobox-thickness"