diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2009-12-14 22:49:44 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2009-12-14 22:49:44 +0100 |
commit | b0921c4b6f55d3e1409f65e3e11ba446bb844514 (patch) | |
tree | eb6558fbae271917ea4588c1bf9e3f3b844c99d2 | |
parent | 415becf8a419d3a81038eb188361e3df27074bb1 (diff) |
super-hack to make playlist look like native gtk treeview
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 2 | ||||
-rw-r--r-- | plugins/gtkui/gtkplaylist.c | 12 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 7 |
3 files changed, 18 insertions, 3 deletions
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 40e3f31e..7f208fa5 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -2111,7 +2111,7 @@ SOCKS5_HOSTNAME</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">True</property> - <property name="rules_hint">False</property> + <property name="rules_hint">True</property> <property name="reorderable">False</property> <property name="enable_search">True</property> <property name="fixed_height_mode">False</property> diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index 54fe173c..a63237b5 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -327,6 +327,13 @@ gtkpl_redraw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) { void gtkpl_draw_pl_row_back (gtkplaylist_t *ps, int row, DB_playItem_t *it) { // draw background + GtkWidget *treeview = lookup_widget (mainwin, "playlist_tree"); + GtkWidget *widget = ps->playlist; + gtk_paint_flat_box (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, (row & 1) ? "cell_even_ruled" : "cell_odd_ruled", 0, row * rowheight - ps->scrollpos * rowheight, widget->allocation.width, rowheight); + if (row == deadbeef->pl_get_cursor (ps->iterator)) { + gtk_paint_focus (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, NULL, treeview, "treeview", 0, row * rowheight - ps->scrollpos * rowheight, widget->allocation.width, rowheight); + } +#if 0 float w; int start, end; int startx, endx; @@ -355,6 +362,7 @@ gtkpl_draw_pl_row_back (gtkplaylist_t *ps, int row, DB_playItem_t *it) { theme_set_fg_color (COLO_PLAYLIST_CURSOR); draw_rect (0, row * rowheight - ps->scrollpos * rowheight, width, rowheight-1, 0); } +#endif } void @@ -407,10 +415,10 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) { if (text) { if (c->align_right) { - draw_text_with_colors (x+5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 1, text); + draw_text (x+5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 1, text); } else { - draw_text_with_colors (x + 5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 0, text); + draw_text (x + 5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 0, text); } } } diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index a7e05e59..eea32b86 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -499,6 +499,11 @@ create_mainwin (void) gtk_widget_show (statusbar); gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0); + GtkWidget *treeview = gtk_tree_view_new (); + gtk_widget_show (treeview); + gtk_box_pack_start (GTK_BOX (vbox1), treeview, FALSE, FALSE, 0); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); + g_signal_connect ((gpointer) mainwin, "key_press_event", G_CALLBACK (on_mainwin_key_press_event), NULL); @@ -787,6 +792,7 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT (mainwin, header, "header"); GLADE_HOOKUP_OBJECT (mainwin, playlist, "playlist"); + GLADE_HOOKUP_OBJECT (mainwin, treeview, "playlist_tree"); GLADE_HOOKUP_OBJECT (mainwin, playscroll, "playscroll"); GLADE_HOOKUP_OBJECT (mainwin, playhscroll, "playhscroll"); GLADE_HOOKUP_OBJECT (mainwin, statusbar, "statusbar"); @@ -1454,6 +1460,7 @@ create_prefwin (void) pref_pluginlist = gtk_tree_view_new (); gtk_widget_show (pref_pluginlist); gtk_container_add (GTK_CONTAINER (scrolledwindow2), pref_pluginlist); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (pref_pluginlist), TRUE); table5 = gtk_table_new (5, 2, FALSE); gtk_widget_show (table5); |