chiark / gitweb /
use GtkStyles everywhere instead of explicit colors. faster.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 Nov 2007 17:29:48 +0000 (17:29 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 11 Nov 2007 17:29:48 +0000 (17:29 +0000)
disobedience/choose.c
disobedience/control.c
disobedience/disobedience.c
disobedience/disobedience.h
disobedience/login.c
disobedience/misc.c
disobedience/properties.c
disobedience/queue.c
disobedience/settings.c

index b740008f3b30578ffac7f7c68e057f8f051ee326..aabc215b1e567cdcc87ad617a9a6313853813683 100644 (file)
@@ -957,18 +957,13 @@ static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
   assert(cn->container);
   /* Set colors */
   BEGIN(colors);
   assert(cn->container);
   /* Set colors */
   BEGIN(colors);
-  /* This section turns out to reliably take >50% of the elapsed time when
-   * displaying the tree, both when it's largely unexpanded and when it's
-   * heavily expanded. */
-  if(search_result)
-    gtk_widget_modify_bg(cn->container, GTK_STATE_NORMAL, &search_bg);
-  else
-    gtk_widget_modify_bg(cn->container, GTK_STATE_NORMAL, &layout_bg);
-  gtk_widget_modify_bg(cn->container, GTK_STATE_SELECTED, &selected_bg);
-  gtk_widget_modify_bg(cn->container, GTK_STATE_PRELIGHT, &selected_bg);
-  gtk_widget_modify_fg(cn->label, GTK_STATE_NORMAL, &item_fg);
-  gtk_widget_modify_fg(cn->label, GTK_STATE_SELECTED, &selected_fg);
-  gtk_widget_modify_fg(cn->label, GTK_STATE_PRELIGHT, &selected_fg);
+  if(search_result) {
+    gtk_widget_set_style(cn->container, search_style);
+    gtk_widget_set_style(cn->label, search_style);
+  } else {
+    gtk_widget_set_style(cn->container, layout_style);
+    gtk_widget_set_style(cn->label, layout_style);
+  }
   END(colors);
   /* Make sure the icon is right */
   BEGIN(markers);
   END(colors);
   /* Make sure the icon is right */
   BEGIN(markers);
@@ -1442,16 +1437,14 @@ GtkWidget *choose_widget(void) {
   /* Text entry box for search terms */
   NW(entry);
   searchentry = gtk_entry_new();
   /* Text entry box for search terms */
   NW(entry);
   searchentry = gtk_entry_new();
+  gtk_widget_set_style(searchentry, tool_style);
   g_signal_connect(searchentry, "changed", G_CALLBACK(searchentry_changed), 0);
   gtk_tooltips_set_tip(tips, searchentry, "Enter search terms here; search is automatic", "");
 
   /* Cancel button to clear the search */
   NW(button);
   clearsearch = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
   g_signal_connect(searchentry, "changed", G_CALLBACK(searchentry_changed), 0);
   gtk_tooltips_set_tip(tips, searchentry, "Enter search terms here; search is automatic", "");
 
   /* Cancel button to clear the search */
   NW(button);
   clearsearch = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-  gtk_widget_modify_bg(clearsearch, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(clearsearch, GTK_STATE_ACTIVE, &tool_active);
-  gtk_widget_modify_bg(clearsearch, GTK_STATE_PRELIGHT, &tool_active);
-  gtk_widget_modify_bg(clearsearch, GTK_STATE_SELECTED, &tool_active);
+  gtk_widget_set_style(clearsearch, tool_style);
   g_signal_connect(G_OBJECT(clearsearch), "clicked",
                    G_CALLBACK(clearsearch_clicked), 0);
   gtk_tooltips_set_tip(tips, clearsearch, "Clear search terms", "");
   g_signal_connect(G_OBJECT(clearsearch), "clicked",
                    G_CALLBACK(clearsearch_clicked), 0);
   gtk_tooltips_set_tip(tips, clearsearch, "Clear search terms", "");
@@ -1461,21 +1454,13 @@ GtkWidget *choose_widget(void) {
   prevsearch = iconbutton("up.png", "Previous search result");
   g_signal_connect(G_OBJECT(prevsearch), "clicked",
                    G_CALLBACK(prev_clicked), 0);
   prevsearch = iconbutton("up.png", "Previous search result");
   g_signal_connect(G_OBJECT(prevsearch), "clicked",
                    G_CALLBACK(prev_clicked), 0);
+  gtk_widget_set_style(prevsearch, tool_style);
   gtk_widget_set_sensitive(prevsearch, 0);
   gtk_widget_set_sensitive(prevsearch, 0);
-  gtk_widget_modify_bg(prevsearch, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(prevsearch, GTK_STATE_ACTIVE, &tool_active);
-  gtk_widget_modify_bg(prevsearch, GTK_STATE_PRELIGHT, &tool_active);
-  gtk_widget_modify_bg(prevsearch, GTK_STATE_SELECTED, &tool_active);
-  gtk_widget_modify_bg(prevsearch, GTK_STATE_INSENSITIVE, &tool_active);
   nextsearch = iconbutton("down.png", "Next search result");
   g_signal_connect(G_OBJECT(nextsearch), "clicked",
                    G_CALLBACK(next_clicked), 0);
   nextsearch = iconbutton("down.png", "Next search result");
   g_signal_connect(G_OBJECT(nextsearch), "clicked",
                    G_CALLBACK(next_clicked), 0);
+  gtk_widget_set_style(nextsearch, tool_style);
   gtk_widget_set_sensitive(nextsearch, 0);
   gtk_widget_set_sensitive(nextsearch, 0);
-  gtk_widget_modify_bg(nextsearch, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(nextsearch, GTK_STATE_ACTIVE, &tool_active);
-  gtk_widget_modify_bg(nextsearch, GTK_STATE_PRELIGHT, &tool_active);
-  gtk_widget_modify_bg(nextsearch, GTK_STATE_SELECTED, &tool_active);
-  gtk_widget_modify_bg(nextsearch, GTK_STATE_INSENSITIVE, &tool_active);
 
   /* hbox packs the search tools button together on a line */
   NW(hbox);
 
   /* hbox packs the search tools button together on a line */
   NW(hbox);
@@ -1493,29 +1478,33 @@ GtkWidget *choose_widget(void) {
    * namespace */
   NW(layout);
   chooselayout = gtk_layout_new(0, 0);
    * namespace */
   NW(layout);
   chooselayout = gtk_layout_new(0, 0);
-  gtk_widget_modify_bg(chooselayout, GTK_STATE_NORMAL, &layout_bg);
+  gtk_widget_set_style(chooselayout, layout_style);
   choose_reset();
   register_reset(choose_reset);
   /* Create the popup menus */
   NW(menu);
   track_menu = gtk_menu_new();
   choose_reset();
   register_reset(choose_reset);
   /* Create the popup menus */
   NW(menu);
   track_menu = gtk_menu_new();
+  gtk_widget_set_style(track_menu, tool_style);
   g_signal_connect(track_menu, "destroy", G_CALLBACK(gtk_widget_destroyed),
                    &track_menu);
   for(n = 0; track_menuitems[n].name; ++n) {
     NW(menu_item);
     track_menuitems[n].w = 
       gtk_menu_item_new_with_label(track_menuitems[n].name);
   g_signal_connect(track_menu, "destroy", G_CALLBACK(gtk_widget_destroyed),
                    &track_menu);
   for(n = 0; track_menuitems[n].name; ++n) {
     NW(menu_item);
     track_menuitems[n].w = 
       gtk_menu_item_new_with_label(track_menuitems[n].name);
+    gtk_widget_set_style(track_menuitems[n].w, tool_style);
     gtk_menu_attach(GTK_MENU(track_menu), track_menuitems[n].w,
                     0, 1, n, n + 1);
   }
   NW(menu);
   dir_menu = gtk_menu_new();
     gtk_menu_attach(GTK_MENU(track_menu), track_menuitems[n].w,
                     0, 1, n, n + 1);
   }
   NW(menu);
   dir_menu = gtk_menu_new();
+  gtk_widget_set_style(dir_menu, tool_style);
   g_signal_connect(dir_menu, "destroy", G_CALLBACK(gtk_widget_destroyed),
                    &dir_menu);
   for(n = 0; dir_menuitems[n].name; ++n) {
     NW(menu_item);
     dir_menuitems[n].w = 
       gtk_menu_item_new_with_label(dir_menuitems[n].name);
   g_signal_connect(dir_menu, "destroy", G_CALLBACK(gtk_widget_destroyed),
                    &dir_menu);
   for(n = 0; dir_menuitems[n].name; ++n) {
     NW(menu_item);
     dir_menuitems[n].w = 
       gtk_menu_item_new_with_label(dir_menuitems[n].name);
+    gtk_widget_set_style(dir_menuitems[n].w, tool_style);
     gtk_menu_attach(GTK_MENU(dir_menu), dir_menuitems[n].w,
                     0, 1, n, n + 1);
   }
     gtk_menu_attach(GTK_MENU(dir_menu), dir_menuitems[n].w,
                     0, 1, n, n + 1);
   }
index 0fde2d09a832320f38898053105988aab54abd31..146816874a78dac8083d566aef3659ddd0ed018f 100644 (file)
@@ -220,8 +220,6 @@ void control_monitor(void attribute((unused)) *u) {
 /** @brief Create the control bar */
 GtkWidget *control_widget(void) {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 1), *vbox;
 /** @brief Create the control bar */
 GtkWidget *control_widget(void) {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 1), *vbox;
-  GtkWidget *content;
-  GdkPixbuf *pb;
   GtkWidget *v, *b;
   int n;
 
   GtkWidget *v, *b;
   int n;
 
@@ -230,21 +228,7 @@ GtkWidget *control_widget(void) {
   assert(mainmenufactory);              /* ordering must be right */
   for(n = 0; n < NICONS; ++n) {
     NW(button);
   assert(mainmenufactory);              /* ordering must be right */
   for(n = 0; n < NICONS; ++n) {
     NW(button);
-    icons[n].button = gtk_button_new();
-    gtk_widget_modify_bg(icons[n].button, GTK_STATE_NORMAL, &tool_bg);
-    gtk_widget_modify_bg(icons[n].button, GTK_STATE_ACTIVE, &tool_active);
-    gtk_widget_modify_bg(icons[n].button, GTK_STATE_PRELIGHT, &tool_active);
-    gtk_widget_modify_bg(icons[n].button, GTK_STATE_SELECTED, &tool_active);
-    gtk_widget_modify_bg(icons[n].button, GTK_STATE_INSENSITIVE, &tool_active);
-    if((pb = find_image(icons[n].icon))) {
-      NW(image);
-      content = gtk_image_new_from_pixbuf(pb);
-    } else {
-      NW(label);
-      content = gtk_label_new(icons[n].icon);
-    }
-    gtk_container_add(GTK_CONTAINER(icons[n].button), content);
-    gtk_tooltips_set_tip(tips, icons[n].button, icons[n].tip, "");
+    icons[n].button = iconbutton(icons[n].icon, icons[n].tip);
     g_signal_connect(G_OBJECT(icons[n].button), "clicked",
                      G_CALLBACK(clicked_icon), &icons[n]);
     /* pop the icon in a vbox so it doesn't get vertically stretch if there are
     g_signal_connect(G_OBJECT(icons[n].button), "clicked",
                      G_CALLBACK(clicked_icon), &icons[n]);
     /* pop the icon in a vbox so it doesn't get vertically stretch if there are
@@ -284,8 +268,8 @@ GtkWidget *control_widget(void) {
   v = gtk_hscale_new(volume_adj);
   NW(hscale);
   b = gtk_hscale_new(balance_adj);
   v = gtk_hscale_new(volume_adj);
   NW(hscale);
   b = gtk_hscale_new(balance_adj);
-  set_slider_colors(v);
-  set_slider_colors(b);
+  gtk_widget_set_style(v, tool_style);
+  gtk_widget_set_style(b, tool_style);
   gtk_scale_set_digits(GTK_SCALE(v), 10);
   gtk_scale_set_digits(GTK_SCALE(b), 10);
   gtk_widget_set_size_request(v, 192, -1);
   gtk_scale_set_digits(GTK_SCALE(v), 10);
   gtk_scale_set_digits(GTK_SCALE(b), 10);
   gtk_widget_set_size_request(v, 192, -1);
index 2d7ab3e03aa753b5ee18362ffd946c11fa096eaa..eb8135f1e05baec3d4b14c132f55ea5239fae2a8 100644 (file)
@@ -138,10 +138,7 @@ static GtkWidget *notebook(void) {
   tabs = gtk_notebook_new();
   /* The current tab is _NORMAL, the rest are _ACTIVE, which is bizarre but
    * produces not too dreadful appearance */
   tabs = gtk_notebook_new();
   /* The current tab is _NORMAL, the rest are _ACTIVE, which is bizarre but
    * produces not too dreadful appearance */
-  gtk_widget_modify_bg(tabs, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(tabs, GTK_STATE_ACTIVE, &tool_active);
-  gtk_widget_modify_fg(tabs, GTK_STATE_NORMAL, &tool_fg);
-  gtk_widget_modify_fg(tabs, GTK_STATE_ACTIVE, &tool_fg);
+  gtk_widget_set_style(tabs, tool_style);
   g_signal_connect(tabs, "switch-page", G_CALLBACK(tab_switched), 0);
   gtk_notebook_append_page(GTK_NOTEBOOK(tabs), queue_widget(),
                            gtk_label_new("Queue"));
   g_signal_connect(tabs, "switch-page", G_CALLBACK(tab_switched), 0);
   gtk_notebook_append_page(GTK_NOTEBOOK(tabs), queue_widget(),
                            gtk_label_new("Queue"));
@@ -186,7 +183,7 @@ static void make_toplevel_window(void) {
                    FALSE,             /* expand */
                    FALSE,             /* fill */
                    0);
                    FALSE,             /* expand */
                    FALSE,             /* fill */
                    0);
-  gtk_widget_modify_bg(toplevel, GTK_STATE_NORMAL, &tool_bg);
+  gtk_widget_set_style(toplevel, tool_style);
 }
 
 #if MDEBUG
 }
 
 #if MDEBUG
@@ -453,6 +450,7 @@ int main(int argc, char **argv) {
   }
   signal(SIGPIPE, SIG_IGN);
   load_settings();
   }
   signal(SIGPIPE, SIG_IGN);
   load_settings();
+  init_styles();
   /* create the event loop */
   D(("create main loop"));
   mainloop = g_main_loop_new(0, 0);
   /* create the event loop */
   D(("create main loop"));
   mainloop = g_main_loop_new(0, 0);
index edb973dab3f4eea8663f72824a8f73188af29fc2..ea5d095257899dc867dbf706cfb371ac9e2dae51 100644 (file)
@@ -247,16 +247,21 @@ void stop_rtp(void);
 
 /* Settings */
 
 
 /* Settings */
 
-extern GdkColor tool_bg, tool_fg, layout_bg, even_bg, odd_bg;
-extern GdkColor active_bg, selected_bg, selected_fg, search_bg;
-extern GdkColor title_bg, title_fg, item_fg, drag_target, tool_active;
+void init_styles(void);
+extern GtkStyle *layout_style;
+extern GtkStyle *title_style;
+extern GtkStyle *even_style;
+extern GtkStyle *odd_style;
+extern GtkStyle *active_style;
+extern GtkStyle *tool_style;
+extern GtkStyle *search_style;
+extern GtkStyle *drag_style;
 
 extern const char *browser;
 
 void save_settings(void);
 void load_settings(void);
 void set_tool_colors(GtkWidget *w);
 
 extern const char *browser;
 
 void save_settings(void);
 void load_settings(void);
 void set_tool_colors(GtkWidget *w);
-void set_slider_colors(GtkWidget *w);
 
 /* Widget leakage debugging rubbish ---------------------------------------- */
 
 
 /* Widget leakage debugging rubbish ---------------------------------------- */
 
index e53e9473f90e7075d5ca861719c641a2fc004b3a..3dff339b4431c8fe7a223616fbb9bf6f03d8856f 100644 (file)
@@ -215,16 +215,16 @@ void login_box(void) {
   default_connect();
   /* Create a new login window */
   login_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   default_connect();
   /* Create a new login window */
   login_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_widget_modify_bg(login_window, GTK_STATE_NORMAL, &tool_bg);
+  gtk_widget_set_style(login_window, tool_style);
   g_signal_connect(login_window, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &login_window);
   gtk_window_set_title(GTK_WINDOW(login_window), "Login Details");
   /* Construct the form */
   table = gtk_table_new(NLWIS + 1/*rows*/, 2/*columns*/, FALSE/*homogenous*/);
   g_signal_connect(login_window, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &login_window);
   gtk_window_set_title(GTK_WINDOW(login_window), "Login Details");
   /* Construct the form */
   table = gtk_table_new(NLWIS + 1/*rows*/, 2/*columns*/, FALSE/*homogenous*/);
-  gtk_widget_modify_bg(table, GTK_STATE_NORMAL, &tool_bg);
+  gtk_widget_set_style(table, tool_style);
   for(n = 0; n < NLWIS; ++n) {
     label = gtk_label_new(lwis[n].description);
   for(n = 0; n < NLWIS; ++n) {
     label = gtk_label_new(lwis[n].description);
-    gtk_widget_modify_fg(table, GTK_STATE_NORMAL, &tool_fg);
+    gtk_widget_set_style(label, tool_style);
     gtk_misc_set_alignment(GTK_MISC(label), 1/*right*/, 0/*bottom*/);
     gtk_table_attach(GTK_TABLE(table), label,
                     0, 1,              /* left/right_attach */
     gtk_misc_set_alignment(GTK_MISC(label), 1/*right*/, 0/*bottom*/);
     gtk_table_attach(GTK_TABLE(table), label,
                     0, 1,              /* left/right_attach */
@@ -232,6 +232,7 @@ void login_box(void) {
                     GTK_FILL, 0,       /* x/yoptions */
                     1, 1);             /* x/ypadding */
     entry = gtk_entry_new();
                     GTK_FILL, 0,       /* x/yoptions */
                     1, 1);             /* x/ypadding */
     entry = gtk_entry_new();
+    gtk_widget_set_style(entry, tool_style);
     gtk_entry_set_visibility(GTK_ENTRY(entry),
                              lwis[n].flags & LWI_HIDDEN ? FALSE : TRUE);
     gtk_entry_set_text(GTK_ENTRY(entry), lwis[n].get());
     gtk_entry_set_visibility(GTK_ENTRY(entry),
                              lwis[n].flags & LWI_HIDDEN ? FALSE : TRUE);
     gtk_entry_set_text(GTK_ENTRY(entry), lwis[n].get());
index 2a80053b8dd510f28e368ab68fbbac864b2bc802..958e2b2c34b1e84e80371205f0d05d81723445ff 100644 (file)
@@ -45,6 +45,7 @@ GtkWidget *scroll_widget(GtkWidget *child) {
   GtkWidget *scroller = gtk_scrolled_window_new(0, 0);
   GtkAdjustment *adj;
 
   GtkWidget *scroller = gtk_scrolled_window_new(0, 0);
   GtkAdjustment *adj;
 
+  gtk_widget_set_style(scroller, tool_style);
   D(("scroll_widget"));
   /* Why isn't _AUTOMATIC the default? */
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),
   D(("scroll_widget"));
   /* Why isn't _AUTOMATIC the default? */
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),
@@ -64,11 +65,10 @@ GtkWidget *scroll_widget(GtkWidget *child) {
     /* Child widget requires a viewport */
     gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroller),
                                           child);
     /* Child widget requires a viewport */
     gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroller),
                                           child);
-    gtk_widget_modify_bg(gtk_bin_get_child(GTK_BIN(scroller)),
-                         GTK_STATE_NORMAL, &tool_bg);
+    gtk_widget_set_style(gtk_bin_get_child(GTK_BIN(scroller)), tool_style);
   }
   }
-  set_slider_colors(GTK_SCROLLED_WINDOW(scroller)->hscrollbar);
-  set_slider_colors(GTK_SCROLLED_WINDOW(scroller)->vscrollbar);
+  gtk_widget_set_style(GTK_SCROLLED_WINDOW(scroller)->hscrollbar, tool_style);
+  gtk_widget_set_style(GTK_SCROLLED_WINDOW(scroller)->vscrollbar, tool_style);
   return scroller;
 }
 
   return scroller;
 }
 
@@ -119,6 +119,7 @@ void popup_msg(GtkMessageType mt, const char *msg) {
                              mt,
                              GTK_BUTTONS_CLOSE,
                              "%s", msg);
                              mt,
                              GTK_BUTTONS_CLOSE,
                              "%s", msg);
+  gtk_widget_set_style(w, tool_style);
   gtk_dialog_run(GTK_DIALOG(w));
   gtk_widget_destroy(w);
 }
   gtk_dialog_run(GTK_DIALOG(w));
   gtk_widget_destroy(w);
 }
@@ -140,7 +141,7 @@ void fpopup_msg(GtkMessageType mt, const char *fmt, ...) {
  * @return Button
  */
 GtkWidget *iconbutton(const char *path, const char *tip) {
  * @return Button
  */
 GtkWidget *iconbutton(const char *path, const char *tip) {
-  GtkWidget *button, *content;;
+  GtkWidget *button, *content;
   GdkPixbuf *pb;
 
   NW(button);
   GdkPixbuf *pb;
 
   NW(button);
@@ -152,6 +153,8 @@ GtkWidget *iconbutton(const char *path, const char *tip) {
     NW(label);
     content = gtk_label_new(path);
   }
     NW(label);
     content = gtk_label_new(path);
   }
+  gtk_widget_set_style(button, tool_style);
+  gtk_widget_set_style(content, tool_style);
   gtk_container_add(GTK_CONTAINER(button), content);
   if(tip)
     gtk_tooltips_set_tip(tips, button, tip, "");
   gtk_container_add(GTK_CONTAINER(button), content);
   if(tip)
     gtk_tooltips_set_tip(tips, button, tip, "");
@@ -166,16 +169,7 @@ GtkWidget *create_buttons(const struct button *buttons,
 
   for(n = 0; n < nbuttons; ++n) {
     GtkWidget *const button = gtk_button_new_from_stock(buttons[n].stock);
 
   for(n = 0; n < nbuttons; ++n) {
     GtkWidget *const button = gtk_button_new_from_stock(buttons[n].stock);
-    gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &tool_bg);
-    gtk_widget_modify_bg(button, GTK_STATE_ACTIVE, &tool_active);
-    gtk_widget_modify_bg(button, GTK_STATE_PRELIGHT, &tool_active);
-    gtk_widget_modify_bg(button, GTK_STATE_SELECTED, &tool_active); 
-    gtk_widget_modify_bg(button, GTK_STATE_INSENSITIVE, &tool_active);
-    gtk_widget_modify_fg(button, GTK_STATE_NORMAL, &tool_fg);
-    gtk_widget_modify_fg(button, GTK_STATE_ACTIVE, &tool_fg);
-    gtk_widget_modify_fg(button, GTK_STATE_PRELIGHT, &tool_fg);
-    gtk_widget_modify_fg(button, GTK_STATE_SELECTED, &tool_fg);
-    gtk_widget_modify_fg(button, GTK_STATE_INSENSITIVE, &tool_fg);
+    gtk_widget_set_style(button, tool_style);
     g_signal_connect(G_OBJECT(button), "clicked",
                      G_CALLBACK(buttons[n].clicked), 0);
     gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
     g_signal_connect(G_OBJECT(button), "clicked",
                      G_CALLBACK(buttons[n].clicked), 0);
     gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
index 99bda206f68e091a982ef1d7eed4305380e2abb8..7ec9042a31e5e5a72c55e0e9db25f1cb778121f0 100644 (file)
@@ -170,8 +170,7 @@ static void propagate_clicked(GtkButton attribute((unused)) *button,
 void properties(int ntracks, const char **tracks) {
   int n, m;
   struct prefdata *f;
 void properties(int ntracks, const char **tracks) {
   int n, m;
   struct prefdata *f;
-  GtkWidget *buttonbox, *vbox, *label, *entry, *propagate, *content;
-  GdkPixbuf *pb;
+  GtkWidget *buttonbox, *vbox, *label, *entry, *propagate;
   
   /* If no tracks, do nothign */
   if(!ntracks)
   
   /* If no tracks, do nothign */
   if(!ntracks)
@@ -190,13 +189,13 @@ void properties(int ntracks, const char **tracks) {
   }
   /* Create a new properties window */
   properties_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   }
   /* Create a new properties window */
   properties_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_widget_modify_bg(properties_window, GTK_STATE_NORMAL, &tool_bg);
+  gtk_widget_set_style(properties_window, tool_style);
   g_signal_connect(properties_window, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &properties_window);
   /* Most of the action is the table of preferences */
   properties_table = gtk_table_new((NPREFS + 1) * ntracks, 2 + ntracks > 1,
                                    FALSE);
   g_signal_connect(properties_window, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &properties_window);
   /* Most of the action is the table of preferences */
   properties_table = gtk_table_new((NPREFS + 1) * ntracks, 2 + ntracks > 1,
                                    FALSE);
-  gtk_widget_modify_bg(properties_table, GTK_STATE_NORMAL, &tool_bg);
+  gtk_widget_set_style(properties_table, tool_style);
   g_signal_connect(properties_table, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &properties_table);
   gtk_window_set_title(GTK_WINDOW(properties_window), "Track Properties");
   g_signal_connect(properties_table, "destroy",
                   G_CALLBACK(gtk_widget_destroyed), &properties_table);
   gtk_window_set_title(GTK_WINDOW(properties_window), "Track Properties");
@@ -208,7 +207,7 @@ void properties(int ntracks, const char **tracks) {
     /* The track itself */
     /* Caption */
     label = gtk_label_new("Track");
     /* The track itself */
     /* Caption */
     label = gtk_label_new("Track");
-    gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &tool_fg);
+    gtk_widget_set_style(label, tool_style);
     gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
     gtk_table_attach(GTK_TABLE(properties_table),
                      label,
     gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
     gtk_table_attach(GTK_TABLE(properties_table),
                      label,
@@ -218,6 +217,7 @@ void properties(int ntracks, const char **tracks) {
                     1, 1);
     /* The track name */
     entry = gtk_entry_new();
                     1, 1);
     /* The track name */
     entry = gtk_entry_new();
+    gtk_widget_set_style(entry, tool_style);
     gtk_entry_set_text(GTK_ENTRY(entry), tracks[n]);
     gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
     gtk_table_attach(GTK_TABLE(properties_table),
     gtk_entry_set_text(GTK_ENTRY(entry), tracks[n]);
     gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
     gtk_table_attach(GTK_TABLE(properties_table),
@@ -230,7 +230,7 @@ void properties(int ntracks, const char **tracks) {
     for(m = 0; m < NPREFS; ++m) {
       /* Caption */
       label = gtk_label_new(prefs[m].label);
     for(m = 0; m < NPREFS; ++m) {
       /* Caption */
       label = gtk_label_new(prefs[m].label);
-      gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &tool_fg);
+      gtk_widget_set_style(label, tool_style);
       gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
       gtk_table_attach(GTK_TABLE(properties_table),
                        label,
       gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
       gtk_table_attach(GTK_TABLE(properties_table),
                        label,
@@ -246,13 +246,7 @@ void properties(int ntracks, const char **tracks) {
       prefs[m].type->kickoff(f);
       if(ntracks > 1) {
         /* Propagation button */
       prefs[m].type->kickoff(f);
       if(ntracks > 1) {
         /* Propagation button */
-        propagate = gtk_button_new();
-        if((pb = find_image("propagate.png")))
-          content = gtk_image_new_from_pixbuf(pb);
-        else
-          content = gtk_label_new("propagate.png");
-        gtk_container_add(GTK_CONTAINER(propagate), content);
-        gtk_tooltips_set_tip(tips, propagate, "Copy to other tracks", "");
+        propagate = iconbutton("propagate.png", "Copy to other tracks");
         g_signal_connect(G_OBJECT(propagate), "clicked",
                          G_CALLBACK(propagate_clicked), f);
         gtk_table_attach(GTK_TABLE(properties_table),
         g_signal_connect(G_OBJECT(propagate), "clicked",
                          G_CALLBACK(propagate_clicked), f);
         gtk_table_attach(GTK_TABLE(properties_table),
@@ -388,8 +382,7 @@ static void kickoff_boolean(struct prefdata *f) {
 
 static void completed_boolean(struct prefdata *f) {
   f->widget = gtk_check_button_new();
 
 static void completed_boolean(struct prefdata *f) {
   f->widget = gtk_check_button_new();
-  gtk_widget_modify_bg(f->widget, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(f->widget, GTK_STATE_PRELIGHT, &tool_active);
+  gtk_widget_set_style(f->widget, tool_style);
   if(!f->value)
     /* Not set, use the default */
     f->value = f->p->default_value;
   if(!f->value)
     /* Not set, use the default */
     f->value = f->p->default_value;
index b3661dc6d5e4dd30a06a963a35485a50bc705853..2469f25158857016a083c03f281f9437ab9c37ae 100644 (file)
@@ -513,8 +513,7 @@ static void update_queue(struct queuelike *ql, struct queue_entry *newq) {
  * @return New widget
  */
 static GtkWidget *wrap_queue_cell(GtkWidget *label,
  * @return New widget
  */
 static GtkWidget *wrap_queue_cell(GtkWidget *label,
-                                  const GdkColor *bgcolor,
-                                  const GdkColor *fgcolor,
+                                  GtkStyle *style,
                                   int *wp) {
   GtkRequisition req;
   GtkWidget *bg;
                                   int *wp) {
   GtkRequisition req;
   GtkWidget *bg;
@@ -533,12 +532,8 @@ static GtkWidget *wrap_queue_cell(GtkWidget *label,
     if(req.width > *wp) *wp = req.width;
   }
   /* Set colors */
     if(req.width > *wp) *wp = req.width;
   }
   /* Set colors */
-  gtk_widget_modify_bg(bg, GTK_STATE_NORMAL, bgcolor);
-  gtk_widget_modify_bg(bg, GTK_STATE_SELECTED, &selected_bg);
-  gtk_widget_modify_bg(bg, GTK_STATE_PRELIGHT, &selected_bg);
-  gtk_widget_modify_fg(label, GTK_STATE_NORMAL, fgcolor);
-  gtk_widget_modify_fg(label, GTK_STATE_SELECTED, &selected_fg);
-  gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &selected_fg);
+  gtk_widget_set_style(bg, style);
+  gtk_widget_set_style(label, style);
   return bg;
 }
 
   return bg;
 }
 
@@ -547,22 +542,20 @@ static GtkWidget *get_queue_cell(struct queuelike *ql,
                                  const struct queue_entry *q,
                                  int row,
                                  int col,
                                  const struct queue_entry *q,
                                  int row,
                                  int col,
-                                 const GdkColor *bgcolor,
-                                 const GdkColor *fgcolor,
+                                 GtkStyle *style,
                                  int *wp) {
   GtkWidget *label;
   D(("get_queue_cell %d %d", row, col));
   label = ql->columns[col].widget(ql, q, ql->columns[col].data);
   gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
                                  int *wp) {
   GtkWidget *label;
   D(("get_queue_cell %d %d", row, col));
   label = ql->columns[col].widget(ql, q, ql->columns[col].data);
   gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
-  return wrap_queue_cell(label, bgcolor, fgcolor, wp);
+  return wrap_queue_cell(label, style, wp);
 }
 
 /** @brief Add a padding cell to the end of a row */
 }
 
 /** @brief Add a padding cell to the end of a row */
-static GtkWidget *get_padding_cell(const GdkColor *bgcolor,
-                                   const GdkColor *fgcolor) {
+static GtkWidget *get_padding_cell(GtkStyle *style) {
   D(("get_padding_cell"));
   NW(label);
   D(("get_padding_cell"));
   NW(label);
-  return wrap_queue_cell(gtk_label_new(""), bgcolor, fgcolor, 0);
+  return wrap_queue_cell(gtk_label_new(""), style, 0);
 }
 
 /* User button press and menu ---------------------------------------------- */
 }
 
 /* User button press and menu ---------------------------------------------- */
@@ -813,7 +806,7 @@ static gboolean queue_drag_motion(GtkWidget attribute((unused)) *widget,
       g_signal_connect(ql->dragmark, "destroy",
                        G_CALLBACK(gtk_widget_destroyed), &ql->dragmark);
       gtk_widget_set_size_request(ql->dragmark, 10240, row ? 4 : 2);
       g_signal_connect(ql->dragmark, "destroy",
                        G_CALLBACK(gtk_widget_destroyed), &ql->dragmark);
       gtk_widget_set_size_request(ql->dragmark, 10240, row ? 4 : 2);
-      gtk_widget_modify_bg(ql->dragmark, GTK_STATE_NORMAL, &drag_target);
+      gtk_widget_set_style(ql->dragmark, drag_style);
       gtk_layout_put(GTK_LAYOUT(ql->mainlayout), ql->dragmark, 0, 
                      (row + 1) * ql->mainrowheight - !!row);
     } else
       gtk_layout_put(GTK_LAYOUT(ql->mainlayout), ql->dragmark, 0, 
                      (row + 1) * ql->mainrowheight - !!row);
     } else
@@ -915,7 +908,7 @@ static void redisplay_queue(struct queuelike *ql) {
   struct queue_entry *q;
   int row, col;
   GList *c, *children;
   struct queue_entry *q;
   int row, col;
   GList *c, *children;
-  const GdkColor *bgcolor;
+  GtkStyle *style;
   GtkRequisition req;  
   GtkWidget *w;
   int maxwidths[MAXCOLUMNS], x, y, titlerowheight;
   GtkRequisition req;  
   GtkWidget *w;
   int maxwidths[MAXCOLUMNS], x, y, titlerowheight;
@@ -955,16 +948,15 @@ static void redisplay_queue(struct queuelike *ql) {
     /* Construct the widgets */
     for(q = ql->q, row = 0; q; q = q->next, ++row) {
       /* Figure out the widget name for this row */
     /* Construct the widgets */
     for(q = ql->q, row = 0; q; q = q->next, ++row) {
       /* Figure out the widget name for this row */
-      if(q == playing_track) bgcolor = &active_bg;
-      else bgcolor = row % 2 ? &even_bg : &odd_bg;
+      if(q == playing_track) style = active_style;
+      else style = row % 2 ? even_style : odd_style;
       /* Make the widget for each column */
       for(col = 0; col <= ql->ncolumns; ++col) {
         /* Create and store the widget */
         if(col < ql->ncolumns)
       /* Make the widget for each column */
       for(col = 0; col <= ql->ncolumns; ++col) {
         /* Create and store the widget */
         if(col < ql->ncolumns)
-          w = get_queue_cell(ql, q, row, col, bgcolor, &item_fg,
-                             &maxwidths[col]);
+          w = get_queue_cell(ql, q, row, col, style, &maxwidths[col]);
         else
         else
-          w = get_padding_cell(bgcolor, &item_fg);
+          w = get_padding_cell(style);
         ql->cells[row * (ql->ncolumns + 1) + col] = w;
         /* Maybe mark it draggable */
         if(draggable_row(q)) {
         ql->cells[row * (ql->ncolumns + 1) + col] = w;
         /* Maybe mark it draggable */
         if(draggable_row(q)) {
@@ -1086,9 +1078,10 @@ static GtkWidget *queuelike(struct queuelike *ql,
   /* Create the layouts */
   NW(layout);
   ql->mainlayout = gtk_layout_new(0, 0);
   /* Create the layouts */
   NW(layout);
   ql->mainlayout = gtk_layout_new(0, 0);
-  gtk_widget_modify_bg(ql->mainlayout, GTK_STATE_NORMAL, &layout_bg);
+  gtk_widget_set_style(ql->mainlayout, layout_style);
   NW(layout);
   ql->titlelayout = gtk_layout_new(0, 0);
   NW(layout);
   ql->titlelayout = gtk_layout_new(0, 0);
+  gtk_widget_set_style(ql->titlelayout, title_style);
   /* Scroll the layouts */
   ql->mainscroll = mainscroll = scroll_widget(ql->mainlayout);
   titlescroll = scroll_widget(ql->titlelayout);
   /* Scroll the layouts */
   ql->mainscroll = mainscroll = scroll_widget(ql->mainlayout);
   titlescroll = scroll_widget(ql->titlelayout);
@@ -1103,10 +1096,10 @@ static GtkWidget *queuelike(struct queuelike *ql,
     NW(label);
     label = gtk_label_new(ql->columns[col].name);
     gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
     NW(label);
     label = gtk_label_new(ql->columns[col].name);
     gtk_misc_set_alignment(GTK_MISC(label), ql->columns[col].xalign, 0);
-    ql->titlecells[col] = wrap_queue_cell(label, &title_bg, &title_fg, 0);
+    ql->titlecells[col] = wrap_queue_cell(label, title_style, 0);
     gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
   }
     gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
   }
-  ql->titlecells[col] = get_padding_cell(&title_bg, &title_fg);
+  ql->titlecells[col] = get_padding_cell(title_style);
   gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
   /* Pack the lot together in a vbox */
   NW(vbox);
   gtk_layout_put(GTK_LAYOUT(ql->titlelayout), ql->titlecells[col], 0, 0);
   /* Pack the lot together in a vbox */
   NW(vbox);
index 75f7396c1095cb4c156cf0d118393b1fe6d57069..a5ea53f761153dc7b94bec7b2c3d6445a6850b5a 100644 (file)
 #include "split.h"
 #include <sys/stat.h>
 
 #include "split.h"
 #include <sys/stat.h>
 
-/** @brief Background colors for tools - menus, icons, etc. */
-GdkColor tool_bg = { 0, 0xDC00, 0xDA00, 0xD500 };
-
-/** @brief Background color for active tool */
-GdkColor tool_active;
-
-/** @brief Foreground colors for tools */
-GdkColor tool_fg = { 0, 0x0000, 0x0000, 0x0000 };
-
-/** @brief Foreground colors for inactive tools */
-GdkColor inactive_tool_fg = { 0, 0x8000, 0x8000, 0x8000 };
-
-/** @brief Background color for the various layouts */
-GdkColor layout_bg = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
-
-/** @brief Title-row background color */
-GdkColor title_bg = { 0, 0x0000, 0x0000, 0x0000 };
-
-/** @brief Title-row foreground color */
-GdkColor title_fg = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
-
-/** @brief Even-row background color */
-GdkColor even_bg = { 0, 0xFFFF, 0xEC00, 0xEBFF };
-
-/** @brief Odd-row background color */
-GdkColor odd_bg = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
-
-/** @brief Active-row background color */
-GdkColor active_bg = { 0, 0xE000, 0xFFFF, 0xE000 };
-
-/** @brief Item foreground color */
-GdkColor item_fg = { 0, 0x0000, 0x0000, 0x0000 };
-
-/** @brief Selected background color */
-GdkColor selected_bg = { 0, 0x4B00, 0x6900, 0x8300 };
-
-/** @brief Selected foreground color */
-GdkColor selected_fg = { 0, 0xFFFF, 0xFFFF, 0xFFFF };
-
-/** @brief Search results */
-GdkColor search_bg = { 0, 0xFFFF, 0xFFFF, 0x0000 };
-
-/** @brief Drag target color */
-GdkColor drag_target = { 0, 0x6666, 0x6666, 0x6666 };
-
 /** @brief HTML displayer */
 const char *browser = BROWSER;
 
 /** @brief HTML displayer */
 const char *browser = BROWSER;
 
-struct colordesc {
-  GdkColor *color;
-  const char *name;
-  const char *description;
-};
-
-#define COLOR(name, description) { &name, #name, description }
-
-/** @brief Table of configurable colors
- *
- * Some of the descriptions could be improve!
- */
-static const struct colordesc colors[] = {
-  COLOR(tool_bg, "Tool background color"),
-  COLOR(tool_fg, "Tool foreground color"),
-  COLOR(layout_bg, "Layout background color"),
-  COLOR(title_bg, "Title row background color"),
-  COLOR(title_fg, "Title row foreground color"),
-  COLOR(even_bg, "Even row background color"),
-  COLOR(odd_bg, "Odd row background color"),
-  COLOR(active_bg, "Playing row background color"),
-  COLOR(item_fg, "Track foreground color"),
-  COLOR(selected_bg, "Selected item background color"),
-  COLOR(selected_fg, "Selected item foreground color"),
-  COLOR(search_bg, "Search result background color"),
-  COLOR(drag_target, "Drag target color"),
-};
-
-#define NCOLORS (sizeof colors / sizeof *colors)
-
 void save_settings(void) {
   char *dir, *path, *tmp;
   FILE *fp = 0;
 void save_settings(void) {
   char *dir, *path, *tmp;
   FILE *fp = 0;
-  size_t n;
 
   byte_xasprintf(&dir, "%s/.disorder", getenv("HOME"));
   byte_xasprintf(&path, "%s/disobedience", dir);
 
   byte_xasprintf(&dir, "%s/.disorder", getenv("HOME"));
   byte_xasprintf(&path, "%s/disobedience", dir);
@@ -126,15 +50,7 @@ void save_settings(void) {
                tmp, strerror(errno));
     goto done;
   }
                tmp, strerror(errno));
     goto done;
   }
-  for(n = 0; n < NCOLORS; ++n)
-    if(fprintf(fp, "color %-20s 0x%04X 0x%04X 0x%04X\n", colors[n].name,
-               colors[n].color->red,
-               colors[n].color->green,
-               colors[n].color->blue) < 0) {
-      fpopup_msg(GTK_MESSAGE_ERROR, "error writing to %s: %s",
-                 tmp, strerror(errno));
-      goto done;
-    }
+  /* TODO */
   if(fclose(fp) < 0) {
     fpopup_msg(GTK_MESSAGE_ERROR, "error writing to %s: %s",
                tmp, strerror(errno));
   if(fclose(fp) < 0) {
     fpopup_msg(GTK_MESSAGE_ERROR, "error writing to %s: %s",
                tmp, strerror(errno));
@@ -157,7 +73,6 @@ static inline unsigned clamp(unsigned n) {
 void load_settings(void) {
   char *path, *line;
   FILE *fp;
 void load_settings(void) {
   char *path, *line;
   FILE *fp;
-  size_t n;
   char **vec;
   int nvec;
 
   char **vec;
   int nvec;
 
@@ -176,15 +91,7 @@ void load_settings(void) {
           error(0, "%s: malformed '%s' command", path, vec[0]);
           continue;
         }
           error(0, "%s: malformed '%s' command", path, vec[0]);
           continue;
         }
-        for(n = 0; n < NCOLORS && strcmp(colors[n].name, vec[1]); ++n)
-          ;
-        if(n >= NCOLORS) {
-          error(0, "%s: unknown color '%s'", path, vec[1]);
-          continue;
-        }
-        colors[n].color->red = strtoul(vec[2], 0, 0);
-        colors[n].color->green = strtoul(vec[3], 0, 0);
-        colors[n].color->blue = strtoul(vec[4], 0, 0);
+        /* TODO */
       } else
         /* mention errors but otherwise ignore them */
         error(0, "%s: unknown command '%s'", path, vec[0]);
       } else
         /* mention errors but otherwise ignore them */
         error(0, "%s: unknown command '%s'", path, vec[0]);
@@ -195,10 +102,6 @@ void load_settings(void) {
       fclose(fp);
     }
   }
       fclose(fp);
     }
   }
-  tool_active = tool_bg;
-  tool_active.red = clamp(105 * tool_active.red / 100);
-  tool_active.green = clamp(105 * tool_active.green / 100);
-  tool_active.blue = clamp(105 * tool_active.blue / 100);
 }
 
 /** @brief Callback used by set_tool_colors() */
 }
 
 /** @brief Callback used by set_tool_colors() */
@@ -211,14 +114,7 @@ static void set_tool_colors_callback(GtkWidget *w,
 void set_tool_colors(GtkWidget *w) {
   GtkWidget *child;
 
 void set_tool_colors(GtkWidget *w) {
   GtkWidget *child;
 
-  gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(w, GTK_STATE_SELECTED, &selected_bg);
-  gtk_widget_modify_bg(w, GTK_STATE_PRELIGHT, &selected_bg);
-  gtk_widget_modify_bg(w, GTK_STATE_INSENSITIVE, &tool_bg);
-  gtk_widget_modify_fg(w, GTK_STATE_NORMAL, &tool_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_SELECTED, &selected_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_PRELIGHT, &selected_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_INSENSITIVE, &inactive_tool_fg);
+  gtk_widget_set_style(w, tool_style);
   if(GTK_IS_CONTAINER(w))
     gtk_container_foreach(GTK_CONTAINER(w), set_tool_colors_callback, 0);
   if(GTK_IS_MENU_ITEM(w)
   if(GTK_IS_CONTAINER(w))
     gtk_container_foreach(GTK_CONTAINER(w), set_tool_colors_callback, 0);
   if(GTK_IS_MENU_ITEM(w)
@@ -226,18 +122,79 @@ void set_tool_colors(GtkWidget *w) {
     set_tool_colors(child);
 }
 
     set_tool_colors(child);
 }
 
-/** @brief Set the colors for a slider */
-void set_slider_colors(GtkWidget *w) {
-  if(!w)
-    return;
-  gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &tool_bg);
-  gtk_widget_modify_bg(w, GTK_STATE_ACTIVE, &tool_bg);
-  gtk_widget_modify_bg(w, GTK_STATE_SELECTED, &tool_active);
-  gtk_widget_modify_bg(w, GTK_STATE_PRELIGHT, &tool_active);
-  gtk_widget_modify_fg(w, GTK_STATE_NORMAL, &tool_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_ACTIVE, &tool_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_SELECTED, &tool_fg);
-  gtk_widget_modify_fg(w, GTK_STATE_PRELIGHT, &tool_fg);
+/** @brief Default style for layouts */
+GtkStyle *layout_style;
+
+/** @brief Title-row style for layouts */
+GtkStyle *title_style;
+
+/** @brief Even-row style for layouts */
+GtkStyle *even_style;
+
+/** @brief Odd-row style for layouts */
+GtkStyle *odd_style;
+
+/** @brief Active-row style for layouts */
+GtkStyle *active_style;
+
+/** @brief Style for tools */
+GtkStyle *tool_style;
+
+/** @brief Style for search results */
+GtkStyle *search_style;
+
+/** @brief Style for drag targets */
+GtkStyle *drag_style;
+
+/** @brief Initialize styles */
+void init_styles(void) {
+  layout_style = gtk_style_new();
+  title_style = gtk_style_new();
+  even_style = gtk_style_new();
+  odd_style = gtk_style_new();
+  active_style = gtk_style_new();
+  search_style = gtk_style_new();
+  tool_style = gtk_style_new();
+  drag_style = gtk_style_new();
+
+  /* Style defaults */
+    
+  /* Layouts are basically black on white */
+  layout_style->bg[GTK_STATE_NORMAL] = layout_style->white;
+  layout_style->fg[GTK_STATE_NORMAL] = layout_style->black;
+    
+  /* Title row is inverted */
+  title_style->bg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+  title_style->fg[GTK_STATE_NORMAL] = layout_style->bg[GTK_STATE_NORMAL];
+
+  /* Active row is pastel green */
+  active_style->bg[GTK_STATE_NORMAL].red = 0xE000;
+  active_style->bg[GTK_STATE_NORMAL].green = 0xFFFF;
+  active_style->bg[GTK_STATE_NORMAL].blue = 0xE000;
+  active_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+  /* Even rows are pastel red */
+  even_style->bg[GTK_STATE_NORMAL].red = 0xFFFF;
+  even_style->bg[GTK_STATE_NORMAL].green = 0xEC00;
+  even_style->bg[GTK_STATE_NORMAL].blue = 0xEC00;
+  even_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+  /* Odd rows match the underlying layout */
+  odd_style->bg[GTK_STATE_NORMAL] = layout_style->bg[GTK_STATE_NORMAL];
+  odd_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+  /* Search results have a yellow background */
+  search_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+  search_style->bg[GTK_STATE_NORMAL].red = 0xFFFF;
+  search_style->bg[GTK_STATE_NORMAL].green = 0xFFFF;
+  search_style->bg[GTK_STATE_NORMAL].blue = 0x0000;
+
+  /* Drag targets are grey */
+  drag_style->bg[GTK_STATE_NORMAL].red = 0x6666;
+  drag_style->bg[GTK_STATE_NORMAL].green = 0x6666;
+  drag_style->bg[GTK_STATE_NORMAL].blue = 0x6666;
+  
+  /* Tools we leave at GTK+ defaults */
 }
 
 /*
 }
 
 /*