diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 2 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/trkproperties.c | 27 |
3 files changed, 21 insertions, 9 deletions
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 7504ea9f..c856d5b3 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -1386,7 +1386,7 @@ <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="resizable">True</property> - <property name="destroy_with_parent">True</property> + <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 928741f4..315a0baf 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -1168,7 +1168,6 @@ create_trackproperties (void) trackproperties = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (trackproperties, 400, 400); gtk_window_set_title (GTK_WINDOW (trackproperties), "Track Properties"); - gtk_window_set_destroy_with_parent (GTK_WINDOW (trackproperties), TRUE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (trackproperties), TRUE); gtk_window_set_skip_pager_hint (GTK_WINDOW (trackproperties), TRUE); diff --git a/plugins/gtkui/trkproperties.c b/plugins/gtkui/trkproperties.c index 4f89a5cb..0fca8145 100644 --- a/plugins/gtkui/trkproperties.c +++ b/plugins/gtkui/trkproperties.c @@ -37,19 +37,33 @@ static DB_playItem_t *track; static GtkCellRenderer *rend_text2; static GtkListStore *store; static GtkListStore *propstore; +static int trkproperties_modified; gboolean on_trackproperties_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { + if (trkproperties_modified) { + GtkWidget *dlg = gtk_message_dialog_new (GTK_WINDOW (mainwin), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "You've modified data for this track."); + gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (trackproperties)); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), "Really close the window?"); + gtk_window_set_title (GTK_WINDOW (dlg), "Warning"); + + int response = gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + if (response != GTK_RESPONSE_YES) { + return TRUE; + } + } + gtk_widget_destroy (widget); rend_text2 = NULL; trackproperties = NULL; if (track) { deadbeef->pl_item_unref (track); track = NULL; } - return FALSE; + return TRUE; } gboolean @@ -58,8 +72,7 @@ on_trackproperties_key_press_event (GtkWidget *widget, gpointer user_data) { if (event->keyval == GDK_Escape) { - on_trackproperties_delete_event (NULL, NULL, NULL); - gtk_widget_destroy (widget); + on_trackproperties_delete_event (trackproperties, NULL, NULL); return TRUE; } return FALSE; @@ -68,9 +81,7 @@ on_trackproperties_key_press_event (GtkWidget *widget, void trkproperties_destroy (void) { if (trackproperties) { - GtkWidget *w = trackproperties; - on_trackproperties_delete_event (NULL, NULL, NULL); - gtk_widget_destroy (w); + on_trackproperties_delete_event (trackproperties, NULL, NULL); } } @@ -89,6 +100,7 @@ on_metadata_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, treepath); gtk_tree_path_free (treepath); gtk_list_store_set (store, &iter, 1, new_text, -1); + trkproperties_modified = 1; } // full metadata @@ -118,7 +130,7 @@ trkproperties_fill_metadata (void) { if (!trackproperties) { return; } - + trkproperties_modified = 0; gtk_list_store_clear (store); deadbeef->pl_lock (); int i = 0; @@ -297,6 +309,7 @@ on_write_tags_clicked (GtkButton *button, break; } } + trkproperties_modified = 0; #if 0 DB_id3v2_tag_t tag; memset (&tag, 0, sizeof (tag)); |