diff options
-rw-r--r-- | plugins/gtkui/callbacks.c | 20 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 28 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 99 | ||||
-rw-r--r-- | plugins/gtkui/widgets.c | 116 |
4 files changed, 146 insertions, 117 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index d65e26b7..4bec4c8e 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -662,26 +662,6 @@ on_toggle_status_bar_activate (GtkMenuItem *menuitem, } void -on_toggle_column_headers_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - // FIXME! - return; - GtkWidget *playlist = lookup_widget (mainwin, "playlist"); - if (playlist) { - if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem))) { - deadbeef->conf_set_int ("gtkui.headers.visible", 0); - ddb_listview_show_header (DDB_LISTVIEW (playlist), 0); - } - else { - deadbeef->conf_set_int ("gtkui.headers.visible", 1); - ddb_listview_show_header (DDB_LISTVIEW (playlist), 1); - } - } - deadbeef->conf_save (); -} - -void on_stop_after_current_activate (GtkMenuItem *menuitem, gpointer user_data) { diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 05b5b2e8..1abef8e2 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -61,7 +61,7 @@ <signal name="activate" handler="on_open_activate" last_modification_time="Sat, 04 Jul 2009 12:57:58 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image619"> + <widget class="GtkImage" id="image629"> <property name="visible">True</property> <property name="stock">gtk-open</property> <property name="icon_size">1</property> @@ -88,7 +88,7 @@ <signal name="activate" handler="on_add_files_activate" last_modification_time="Sat, 04 Jul 2009 13:04:01 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image620"> + <widget class="GtkImage" id="image630"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -109,7 +109,7 @@ <signal name="activate" handler="on_add_folders_activate" last_modification_time="Sun, 06 Sep 2009 17:51:40 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image621"> + <widget class="GtkImage" id="image631"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -178,7 +178,7 @@ <signal name="activate" handler="on_quit_activate" last_modification_time="Sat, 04 Jul 2009 12:57:58 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image622"> + <widget class="GtkImage" id="image632"> <property name="visible">True</property> <property name="stock">gtk-quit</property> <property name="icon_size">1</property> @@ -212,7 +212,7 @@ <signal name="activate" handler="on_clear1_activate" last_modification_time="Sun, 06 Sep 2009 18:30:03 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image623"> + <widget class="GtkImage" id="image633"> <property name="visible">True</property> <property name="stock">gtk-clear</property> <property name="icon_size">1</property> @@ -269,7 +269,7 @@ <signal name="activate" handler="on_remove1_activate" last_modification_time="Sun, 06 Sep 2009 18:30:03 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image624"> + <widget class="GtkImage" id="image634"> <property name="visible">True</property> <property name="stock">gtk-remove</property> <property name="icon_size">1</property> @@ -419,16 +419,6 @@ </child> <child> - <widget class="GtkCheckMenuItem" id="view_headers"> - <property name="visible">True</property> - <property name="label" translatable="yes">Column headers</property> - <property name="use_underline">True</property> - <property name="active">False</property> - <signal name="activate" handler="on_toggle_column_headers_activate" last_modification_time="Sun, 13 Dec 2009 17:24:47 GMT"/> - </widget> - </child> - - <child> <widget class="GtkCheckMenuItem" id="menu_bar1"> <property name="visible">True</property> <property name="label" translatable="yes">Menu bar</property> @@ -648,7 +638,7 @@ <signal name="activate" handler="on_help1_activate" last_modification_time="Tue, 08 Sep 2009 17:32:06 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image625"> + <widget class="GtkImage" id="image635"> <property name="visible">True</property> <property name="stock">gtk-help</property> <property name="icon_size">1</property> @@ -708,7 +698,7 @@ <signal name="activate" handler="on_about1_activate" last_modification_time="Sat, 04 Jul 2009 12:57:58 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image626"> + <widget class="GtkImage" id="image636"> <property name="visible">True</property> <property name="stock">gtk-about</property> <property name="icon_size">1</property> @@ -729,7 +719,7 @@ <signal name="activate" handler="on_translators1_activate" last_modification_time="Sun, 19 Sep 2010 13:38:07 GMT"/> <child internal-child="image"> - <widget class="GtkImage" id="image627"> + <widget class="GtkImage" id="image637"> <property name="visible">True</property> <property name="stock">gtk-about</property> <property name="icon_size">1</property> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 2ebef8ea..1d54e124 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -35,12 +35,12 @@ create_mainwin (void) GtkWidget *File; GtkWidget *File_menu; GtkWidget *open; - GtkWidget *image619; + GtkWidget *image629; GtkWidget *separator2; GtkWidget *add_files; - GtkWidget *image620; + GtkWidget *image630; GtkWidget *add_folders; - GtkWidget *image621; + GtkWidget *image631; GtkWidget *add_location1; GtkWidget *separatormenuitem1; GtkWidget *new_playlist1; @@ -48,18 +48,18 @@ create_mainwin (void) GtkWidget *playlist_save_as; GtkWidget *separator8; GtkWidget *quit; - GtkWidget *image622; + GtkWidget *image632; GtkWidget *Edit; GtkWidget *Edit_menu; GtkWidget *clear1; - GtkWidget *image623; + GtkWidget *image633; GtkWidget *select_all1; GtkWidget *deselect_all1; GtkWidget *invert_selection1; GtkWidget *Selection; GtkWidget *Selection_menu; GtkWidget *remove1; - GtkWidget *image624; + GtkWidget *image634; GtkWidget *crop1; GtkWidget *find1; GtkWidget *sort_by1; @@ -76,7 +76,6 @@ create_mainwin (void) GtkWidget *View; GtkWidget *View_menu; GtkWidget *view_status_bar; - GtkWidget *view_headers; GtkWidget *menu_bar1; GtkWidget *view_tabs; GtkWidget *view_eq; @@ -104,16 +103,16 @@ create_mainwin (void) GtkWidget *Help; GtkWidget *Help_menu; GtkWidget *help1; - GtkWidget *image625; + GtkWidget *image635; GtkWidget *changelog1; GtkWidget *separator10; GtkWidget *gpl1; GtkWidget *lgpl1; GtkWidget *separator9; GtkWidget *about1; - GtkWidget *image626; + GtkWidget *image636; GtkWidget *translators1; - GtkWidget *image627; + GtkWidget *image637; GtkWidget *hbox2; GtkWidget *hbox3; GtkWidget *stopbtn; @@ -155,9 +154,9 @@ create_mainwin (void) gtk_widget_show (open); gtk_container_add (GTK_CONTAINER (File_menu), open); - image619 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); - gtk_widget_show (image619); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (open), image619); + image629 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); + gtk_widget_show (image629); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (open), image629); separator2 = gtk_separator_menu_item_new (); gtk_widget_show (separator2); @@ -168,17 +167,17 @@ create_mainwin (void) gtk_widget_show (add_files); gtk_container_add (GTK_CONTAINER (File_menu), add_files); - image620 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image620); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_files), image620); + image630 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image630); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_files), image630); add_folders = gtk_image_menu_item_new_with_mnemonic (_("Add folder(s)")); gtk_widget_show (add_folders); gtk_container_add (GTK_CONTAINER (File_menu), add_folders); - image621 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image621); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_folders), image621); + image631 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image631); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_folders), image631); add_location1 = gtk_menu_item_new_with_mnemonic (_("Add location")); gtk_widget_show (add_location1); @@ -210,9 +209,9 @@ create_mainwin (void) gtk_widget_show (quit); gtk_container_add (GTK_CONTAINER (File_menu), quit); - image622 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_MENU); - gtk_widget_show (image622); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (quit), image622); + image632 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_MENU); + gtk_widget_show (image632); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (quit), image632); Edit = gtk_menu_item_new_with_mnemonic (_("_Edit")); gtk_widget_show (Edit); @@ -225,9 +224,9 @@ create_mainwin (void) gtk_widget_show (clear1); gtk_container_add (GTK_CONTAINER (Edit_menu), clear1); - image623 = gtk_image_new_from_stock ("gtk-clear", GTK_ICON_SIZE_MENU); - gtk_widget_show (image623); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (clear1), image623); + image633 = gtk_image_new_from_stock ("gtk-clear", GTK_ICON_SIZE_MENU); + gtk_widget_show (image633); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (clear1), image633); select_all1 = gtk_menu_item_new_with_mnemonic (_("Select all")); gtk_widget_show (select_all1); @@ -252,9 +251,9 @@ create_mainwin (void) gtk_widget_show (remove1); gtk_container_add (GTK_CONTAINER (Selection_menu), remove1); - image624 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU); - gtk_widget_show (image624); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (remove1), image624); + image634 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU); + gtk_widget_show (image634); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (remove1), image634); crop1 = gtk_menu_item_new_with_mnemonic (_("Crop")); gtk_widget_show (crop1); @@ -319,10 +318,6 @@ create_mainwin (void) gtk_widget_show (view_status_bar); gtk_container_add (GTK_CONTAINER (View_menu), view_status_bar); - view_headers = gtk_check_menu_item_new_with_mnemonic (_("Column headers")); - gtk_widget_show (view_headers); - gtk_container_add (GTK_CONTAINER (View_menu), view_headers); - menu_bar1 = gtk_check_menu_item_new_with_mnemonic (_("Menu bar")); gtk_widget_show (menu_bar1); gtk_container_add (GTK_CONTAINER (View_menu), menu_bar1); @@ -436,9 +431,9 @@ create_mainwin (void) gtk_widget_show (help1); gtk_container_add (GTK_CONTAINER (Help_menu), help1); - image625 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); - gtk_widget_show (image625); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image625); + image635 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); + gtk_widget_show (image635); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image635); changelog1 = gtk_menu_item_new_with_mnemonic (_("_ChangeLog")); gtk_widget_show (changelog1); @@ -466,17 +461,17 @@ create_mainwin (void) gtk_widget_show (about1); gtk_container_add (GTK_CONTAINER (Help_menu), about1); - image626 = gtk_image_new_from_stock ("gtk-about", GTK_ICON_SIZE_MENU); - gtk_widget_show (image626); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (about1), image626); + image636 = gtk_image_new_from_stock ("gtk-about", GTK_ICON_SIZE_MENU); + gtk_widget_show (image636); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (about1), image636); translators1 = gtk_image_menu_item_new_with_mnemonic (_("_Translators")); gtk_widget_show (translators1); gtk_container_add (GTK_CONTAINER (Help_menu), translators1); - image627 = gtk_image_new_from_stock ("gtk-about", GTK_ICON_SIZE_MENU); - gtk_widget_show (image627); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (translators1), image627); + image637 = gtk_image_new_from_stock ("gtk-about", GTK_ICON_SIZE_MENU); + gtk_widget_show (image637); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (translators1), image637); hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox2); @@ -657,9 +652,6 @@ create_mainwin (void) g_signal_connect ((gpointer) view_status_bar, "activate", G_CALLBACK (on_toggle_status_bar_activate), NULL); - g_signal_connect ((gpointer) view_headers, "activate", - G_CALLBACK (on_toggle_column_headers_activate), - NULL); g_signal_connect ((gpointer) menu_bar1, "activate", G_CALLBACK (on_menu_bar1_activate), NULL); @@ -746,12 +738,12 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, File, "File"); GLADE_HOOKUP_OBJECT (mainwin, File_menu, "File_menu"); GLADE_HOOKUP_OBJECT (mainwin, open, "open"); - GLADE_HOOKUP_OBJECT (mainwin, image619, "image619"); + GLADE_HOOKUP_OBJECT (mainwin, image629, "image629"); GLADE_HOOKUP_OBJECT (mainwin, separator2, "separator2"); GLADE_HOOKUP_OBJECT (mainwin, add_files, "add_files"); - GLADE_HOOKUP_OBJECT (mainwin, image620, "image620"); + GLADE_HOOKUP_OBJECT (mainwin, image630, "image630"); GLADE_HOOKUP_OBJECT (mainwin, add_folders, "add_folders"); - GLADE_HOOKUP_OBJECT (mainwin, image621, "image621"); + GLADE_HOOKUP_OBJECT (mainwin, image631, "image631"); GLADE_HOOKUP_OBJECT (mainwin, add_location1, "add_location1"); GLADE_HOOKUP_OBJECT (mainwin, separatormenuitem1, "separatormenuitem1"); GLADE_HOOKUP_OBJECT (mainwin, new_playlist1, "new_playlist1"); @@ -759,18 +751,18 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, playlist_save_as, "playlist_save_as"); GLADE_HOOKUP_OBJECT (mainwin, separator8, "separator8"); GLADE_HOOKUP_OBJECT (mainwin, quit, "quit"); - GLADE_HOOKUP_OBJECT (mainwin, image622, "image622"); + GLADE_HOOKUP_OBJECT (mainwin, image632, "image632"); GLADE_HOOKUP_OBJECT (mainwin, Edit, "Edit"); GLADE_HOOKUP_OBJECT (mainwin, Edit_menu, "Edit_menu"); GLADE_HOOKUP_OBJECT (mainwin, clear1, "clear1"); - GLADE_HOOKUP_OBJECT (mainwin, image623, "image623"); + GLADE_HOOKUP_OBJECT (mainwin, image633, "image633"); GLADE_HOOKUP_OBJECT (mainwin, select_all1, "select_all1"); GLADE_HOOKUP_OBJECT (mainwin, deselect_all1, "deselect_all1"); GLADE_HOOKUP_OBJECT (mainwin, invert_selection1, "invert_selection1"); GLADE_HOOKUP_OBJECT (mainwin, Selection, "Selection"); GLADE_HOOKUP_OBJECT (mainwin, Selection_menu, "Selection_menu"); GLADE_HOOKUP_OBJECT (mainwin, remove1, "remove1"); - GLADE_HOOKUP_OBJECT (mainwin, image624, "image624"); + GLADE_HOOKUP_OBJECT (mainwin, image634, "image634"); GLADE_HOOKUP_OBJECT (mainwin, crop1, "crop1"); GLADE_HOOKUP_OBJECT (mainwin, find1, "find1"); GLADE_HOOKUP_OBJECT (mainwin, sort_by1, "sort_by1"); @@ -787,7 +779,6 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, View, "View"); GLADE_HOOKUP_OBJECT (mainwin, View_menu, "View_menu"); GLADE_HOOKUP_OBJECT (mainwin, view_status_bar, "view_status_bar"); - GLADE_HOOKUP_OBJECT (mainwin, view_headers, "view_headers"); GLADE_HOOKUP_OBJECT (mainwin, menu_bar1, "menu_bar1"); GLADE_HOOKUP_OBJECT (mainwin, view_tabs, "view_tabs"); GLADE_HOOKUP_OBJECT (mainwin, view_eq, "view_eq"); @@ -813,16 +804,16 @@ create_mainwin (void) GLADE_HOOKUP_OBJECT (mainwin, Help, "Help"); GLADE_HOOKUP_OBJECT (mainwin, Help_menu, "Help_menu"); GLADE_HOOKUP_OBJECT (mainwin, help1, "help1"); - GLADE_HOOKUP_OBJECT (mainwin, image625, "image625"); + GLADE_HOOKUP_OBJECT (mainwin, image635, "image635"); GLADE_HOOKUP_OBJECT (mainwin, changelog1, "changelog1"); GLADE_HOOKUP_OBJECT (mainwin, separator10, "separator10"); GLADE_HOOKUP_OBJECT (mainwin, gpl1, "gpl1"); GLADE_HOOKUP_OBJECT (mainwin, lgpl1, "lgpl1"); GLADE_HOOKUP_OBJECT (mainwin, separator9, "separator9"); GLADE_HOOKUP_OBJECT (mainwin, about1, "about1"); - GLADE_HOOKUP_OBJECT (mainwin, image626, "image626"); + GLADE_HOOKUP_OBJECT (mainwin, image636, "image636"); GLADE_HOOKUP_OBJECT (mainwin, translators1, "translators1"); - GLADE_HOOKUP_OBJECT (mainwin, image627, "image627"); + GLADE_HOOKUP_OBJECT (mainwin, image637, "image637"); GLADE_HOOKUP_OBJECT (mainwin, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT (mainwin, hbox3, "hbox3"); GLADE_HOOKUP_OBJECT (mainwin, stopbtn, "stopbtn"); diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c index 50718874..9b4d429a 100644 --- a/plugins/gtkui/widgets.c +++ b/plugins/gtkui/widgets.c @@ -65,14 +65,14 @@ typedef struct { typedef struct { ddb_gtkui_widget_t base; - DdbTabStrip *tabstrip; DdbListview *list; -} w_tabbed_playlist_t; + int hideheaders; +} w_playlist_t; typedef struct { - ddb_gtkui_widget_t base; - DdbListview *list; -} w_playlist_t; + w_playlist_t plt; + DdbTabStrip *tabstrip; +} w_tabbed_playlist_t; typedef struct { ddb_gtkui_widget_t base; @@ -753,7 +753,6 @@ w_splitter_load (struct ddb_gtkui_widget_s *w, const char *type, const char *s) if (strcmp (type, "vsplitter") && strcmp (type, "hsplitter")) { return NULL; } - printf ("loading splitter\n"); char t[MAX_TOKEN]; for (;;) { s = gettoken_ext (s, t, "={}();"); @@ -1361,7 +1360,7 @@ typedef struct { static gboolean tabbed_trackinfochanged_cb (gpointer p) { w_trackdata_t *d = p; - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)d->w; + w_playlist_t *tp = (w_playlist_t *)d->w; ddb_playlist_t *plt = deadbeef->plt_get_curr (); if (plt) { int idx = deadbeef->plt_get_item_idx (plt, (DB_playItem_t *)d->trk, PL_MAIN); @@ -1398,7 +1397,7 @@ trackinfochanged_cb (gpointer data) { static gboolean tabbed_paused_cb (gpointer p) { - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)p; + w_playlist_t *tp = (w_playlist_t *)p; DB_playItem_t *curr = deadbeef->streamer_get_playing_track (); if (curr) { int idx = deadbeef->pl_get_idx_of (curr); @@ -1422,7 +1421,7 @@ paused_cb (gpointer data) { static gboolean tabbed_refresh_cb (gpointer p) { - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)p; + w_playlist_t *tp = (w_playlist_t *)p; ddb_listview_clear_sort (tp->list); ddb_listview_refresh (tp->list, DDB_REFRESH_LIST | DDB_REFRESH_VSCROLL); return FALSE; @@ -1438,14 +1437,14 @@ refresh_cb (gpointer data) { static gboolean tabbed_playlistswitch_cb (gpointer p) { - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)p; + w_playlist_t *tp = (w_playlist_t *)p; int curr = deadbeef->plt_get_curr_idx (); char conf[100]; snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr); int scroll = deadbeef->conf_get_int (conf, 0); snprintf (conf, sizeof (conf), "playlist.cursor.%d", curr); int cursor = deadbeef->conf_get_int (conf, -1); - ddb_tabstrip_refresh (tp->tabstrip); + ddb_tabstrip_refresh (((w_tabbed_playlist_t *)tp)->tabstrip); deadbeef->pl_set_cursor (PL_MAIN, cursor); if (cursor != -1) { DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (cursor, PL_MAIN); @@ -1494,7 +1493,7 @@ tabbed_songchanged_cb (gpointer p) { struct fromto_t *ft = p; DB_playItem_t *from = ft->from; DB_playItem_t *to = ft->to; - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)ft->w; + w_playlist_t *tp = (w_playlist_t *)ft->w; int to_idx = -1; if (!ddb_listview_is_scrolling (tp->list) && to) { int cursor_follows_playback = deadbeef->conf_get_int ("playlist.scroll.cursorfollowplayback", 1); @@ -1583,7 +1582,7 @@ songchanged_cb (gpointer data) { static gboolean tabbed_trackfocus_cb (gpointer p) { - w_tabbed_playlist_t *tp = p; + w_playlist_t *tp = p; DB_playItem_t *it = deadbeef->streamer_get_playing_track (); if (it) { int idx = deadbeef->pl_get_idx_of (it); @@ -1615,7 +1614,7 @@ trackfocus_cb (gpointer p) { static int w_tabbed_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) { - w_tabbed_playlist_t *tp = (w_tabbed_playlist_t *)w; + w_playlist_t *tp = (w_playlist_t *)w; switch (id) { case DB_EV_SONGCHANGED: g_idle_add (redraw_queued_tracks_cb, tp->list); @@ -1718,20 +1717,91 @@ w_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t } return 0; } + +static const char * +w_playlist_load (struct ddb_gtkui_widget_s *w, const char *type, const char *s) { + if (strcmp (type, "playlist") && strcmp (type, "tabbed_playlist")) { + return NULL; + } + char t[MAX_TOKEN]; + for (;;) { + s = gettoken_ext (s, t, "={}();"); + if (!s) { + return NULL; + } + + if (!strcmp (t, "{")) { + break; + } + + char val[MAX_TOKEN]; + s = gettoken_ext (s, val, "={}();"); + if (!s || strcmp (val, "=")) { + return NULL; + } + s = gettoken_ext (s, val, "={}();"); + if (!s) { + return NULL; + } + + if (!strcmp (t, "hideheaders")) { + ((w_playlist_t *)w)->hideheaders = atoi (val); + } + } + + return s; +} + +static void +w_playlist_save (struct ddb_gtkui_widget_s *w, char *s, int sz) { + char save[100]; + snprintf (save, sizeof (save), " hideheaders=%d", ((w_playlist_t *)w)->hideheaders); + strncat (s, save, sz); +} + +static void +w_playlist_init (ddb_gtkui_widget_t *base) { + w_playlist_t *w = (w_playlist_t *)base; + ddb_listview_show_header (w->list, !w->hideheaders); +} + +static void +on_playlist_showheaders_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { + w_playlist_t *w = user_data; + w->hideheaders = !gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (checkmenuitem)); + ddb_listview_show_header (DDB_LISTVIEW (w->list), !w->hideheaders); +} + +static void +w_playlist_initmenu (struct ddb_gtkui_widget_s *w, GtkWidget *menu) { + GtkWidget *item; + item = gtk_check_menu_item_new_with_mnemonic (_("Show Column Headers")); + gtk_widget_show (item); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), !((w_playlist_t *)w)->hideheaders); + gtk_container_add (GTK_CONTAINER (menu), item); + g_signal_connect ((gpointer) item, "toggled", + G_CALLBACK (on_playlist_showheaders_toggled), + w); +} + ddb_gtkui_widget_t * w_tabbed_playlist_create (void) { w_tabbed_playlist_t *w = malloc (sizeof (w_tabbed_playlist_t)); memset (w, 0, sizeof (w_tabbed_playlist_t)); GtkWidget *vbox = gtk_vbox_new (FALSE, 0); - w->base.widget = vbox; + w->plt.base.widget = vbox; + w->plt.base.save = w_playlist_save; + w->plt.base.load = w_playlist_load; + w->plt.base.init = w_playlist_init; + w->plt.base.initmenu = w_playlist_initmenu; gtk_widget_show (vbox); GtkWidget *tabstrip = ddb_tabstrip_new (); w->tabstrip = (DdbTabStrip *)tabstrip; gtk_widget_show (tabstrip); GtkWidget *list = ddb_listview_new (); - w->list = (DdbListview *)list; + w->plt.list = (DdbListview *)list; gtk_widget_show (list); gtk_box_pack_start (GTK_BOX (vbox), tabstrip, FALSE, TRUE, 0); @@ -1742,17 +1812,11 @@ w_tabbed_playlist_create (void) { gtk_box_pack_start (GTK_BOX (vbox), list, TRUE, TRUE, 0); main_playlist_init (list); - if (deadbeef->conf_get_int ("gtkui.headers.visible", 1)) { - ddb_listview_show_header (w->list, 1); - } - else { - ddb_listview_show_header (w->list, 0); - } // gtk_container_forall (GTK_CONTAINER (w->base.widget), w_override_signals, w); - w_override_signals (w->base.widget, w); + w_override_signals (w->plt.base.widget, w); - w->base.message = w_tabbed_playlist_message; + w->plt.base.message = w_tabbed_playlist_message; return (ddb_gtkui_widget_t*)w; } @@ -1764,6 +1828,10 @@ w_playlist_create (void) { memset (w, 0, sizeof (w_playlist_t)); w->base.widget = gtk_event_box_new (); w->list = DDB_LISTVIEW (ddb_listview_new ()); + w->base.save = w_playlist_save; + w->base.load = w_playlist_load; + w->base.init = w_playlist_init; + w->base.initmenu = w_playlist_initmenu; gtk_widget_show (GTK_WIDGET (w->list)); main_playlist_init (GTK_WIDGET (w->list)); if (deadbeef->conf_get_int ("gtkui.headers.visible", 1)) { |