Mercurial > audlegacy-plugins
annotate src/mtp_up/mtp.c @ 3076:5b59df43b93f
Update the playback slider at the end of a seek (bug #31)
author | John Lindgren <john.lindgren@tds.net> |
---|---|
date | Sun, 26 Apr 2009 16:11:55 -0400 |
parents | 3134a0987162 |
children |
rev | line source |
---|---|
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
1 /* |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
2 * Audacious MTP upload plugin |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
3 * |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
4 * Copyright (c) 2007 Cristian Magherusan <majeru@atheme.org> |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
5 * |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
8 * the Free Software Foundation; under version 3 of the License. |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
9 * |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
14 * |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
16 * along with this program. If not, see <http://www.gnu.org/licenses>. |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
17 */ |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
18 |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
19 #include <config.h> |
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
20 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
21 #include <glib.h> |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
22 #include <sys/types.h> |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
23 #include <libmtp.h> |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2935
diff
changeset
|
24 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2935
diff
changeset
|
25 #include <audlegacy/ui_plugin_menu.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2935
diff
changeset
|
26 #include <audlegacy/i18n.h> |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
27 |
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
28 #include <gtk/gtk.h> |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
29 #include "filetype.h" |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
30 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
31 #define DEBUG 1 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
32 |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
33 #define UP_DEFAULT_LABEL _("Upload selected track(s)") |
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
34 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
35 GMutex * mutex = NULL; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
36 gboolean mtp_initialised = FALSE; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
37 LIBMTP_mtpdevice_t *mtp_device = NULL; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
38 LIBMTP_progressfunc_t *callback; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
39 LIBMTP_file_t *filelist; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
40 Playlist *active_playlist; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
41 |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
42 static gboolean plugin_active = FALSE,exiting=FALSE; |
1461
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
43 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
44 void mtp_init ( void ); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
45 void mtp_cleanup ( void ); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
46 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
47 GeneralPlugin mtp_gp = |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
48 { |
2149 | 49 .description = "MTP Upload", |
50 .init = mtp_init, | |
51 .cleanup = mtp_cleanup | |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
52 }; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
53 GtkWidget *mtp_root_menuitem,*mtp_submenu_item_up,*mtp_submenu_item_free,*mtp_submenu; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
54 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
55 GeneralPlugin *mtp_gplist[] = { &mtp_gp, NULL }; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
56 DECLARE_PLUGIN(mtp_gp, NULL, NULL, NULL, NULL, NULL, mtp_gplist, NULL, NULL) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
57 |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
58 |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
59 void show_dialog(const gchar* message) |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
60 { |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
61 GDK_THREADS_ENTER(); |
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
62 GtkWidget *dialog = gtk_message_dialog_new (NULL, |
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
63 GTK_DIALOG_MODAL, |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
64 GTK_MESSAGE_ERROR, |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
65 GTK_BUTTONS_OK, |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
66 message); |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
67 gtk_dialog_run (GTK_DIALOG (dialog)); |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
68 gtk_widget_show(dialog); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
69 /* gtk_widget_destroy(dialog); */ |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
70 GDK_THREADS_LEAVE(); |
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
71 |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
72 } |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
73 |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
74 gboolean free_device(void) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
75 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
76 #if DEBUG |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
77 if(mtp_initialised) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
78 g_print("\n\n !!!CAUTION!!! \n\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
79 "Cleaning up MTP upload plugin, please wait!!!...\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
80 "This will block until the pending tracks are uploaded,\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
81 "then it will gracefully close your device\n\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
82 "!!! FORCING SHUTDOWN NOW MAY CAUSE DAMAGE TO YOUR DEVICE !!!\n\n\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
83 "Waiting for the MTP mutex to unlock...\n"); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
84 #endif |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
85 if(!mutex) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
86 return TRUE; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
87 g_mutex_lock(mutex); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
88 if(mtp_device!= NULL) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
89 { |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
90 LIBMTP_Release_Device(mtp_device); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
91 mtp_device = NULL; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
92 mtp_initialised = FALSE; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
93 gtk_widget_hide(mtp_submenu_item_free); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
94 } |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
95 g_mutex_unlock(mutex); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
96 return TRUE; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
97 } |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
98 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
99 GList * get_upload_list() |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
100 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
101 Tuple *tuple; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
102 GList *node=NULL,*up_list=NULL; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
103 PlaylistEntry *entry; |
2057
cf4fa45ffd80
playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
104 Playlist *current_play = aud_playlist_get_active(); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
105 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
106 node = current_play->entries; |
1675
ae9b0327b620
Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
107 PLAYLIST_LOCK(current_play); /*needed so that the user doesn't modify the selection*/ |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
108 while (node) /*while creating the list of files to be uploaded*/ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
109 { |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
110 entry = PLAYLIST_ENTRY(node->data); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
111 if (entry->selected) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
112 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
113 tuple = entry->tuple; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
114 up_list=g_list_prepend(up_list,tuple); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
115 entry->selected = FALSE; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
116 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
117 node = g_list_next(node); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
118 } |
1675
ae9b0327b620
Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
119 PLAYLIST_UNLOCK(current_play); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
120 return g_list_reverse(up_list); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
121 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
122 |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
123 LIBMTP_track_t *track_metadata(Tuple *from_tuple) |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
124 { |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
125 LIBMTP_track_t *tr; |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
126 gchar *filename, *uri_path; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
127 VFSFile *f; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
128 uint64_t filesize; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
129 uint32_t parent_id = 0; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
130 struct stat sb; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
131 |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
132 uri_path = g_strdup_printf("%s/%s", aud_tuple_get_string(from_tuple, FIELD_FILE_PATH, NULL), aud_tuple_get_string(from_tuple, FIELD_FILE_NAME, NULL)); |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
133 gchar *tmp = g_strescape(uri_path,NULL); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
134 filename=g_filename_from_uri(tmp,NULL,NULL); |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
135 g_free(tmp); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
136 /* dealing the stream upload (invalidating)*/ |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
137 if(filename) |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
138 { |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
139 f = aud_vfs_fopen(uri_path,"r"); |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
140 g_free(uri_path); |
1978 | 141 if(aud_vfs_is_streaming(f)) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
142 { |
1978 | 143 aud_vfs_fclose(f); |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
144 g_free(filename); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
145 return NULL; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
146 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
147 } |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
148 else |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
149 { |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
150 g_print("Warning! the filename is NULL, exiting"); |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
151 return NULL; |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
152 |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
153 } |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
154 |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
155 if ( stat(filename, &sb) == -1 ) |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
156 { |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
157 #if DEBUG |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
158 g_print("ERROR! encountered while stat()'ing \"%s\"\n",filename); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
159 #endif |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
160 g_free(filename); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
161 return NULL; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
162 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
163 filesize = (uint64_t) sb.st_size; |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
164 parent_id = mtp_device->default_music_folder; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
165 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
166 /* track metadata*/ |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
167 tr = LIBMTP_new_track_t(); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
168 tr->title = g_strdup((gchar*) aud_tuple_get_string(from_tuple, FIELD_TITLE, NULL)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
169 tr->artist = g_strdup((gchar*) aud_tuple_get_string(from_tuple, FIELD_ARTIST, NULL)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
170 tr->album = g_strdup((gchar*)aud_tuple_get_string(from_tuple, FIELD_ALBUM, NULL)); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
171 tr->filesize = filesize; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
172 tr->filename = g_strdup(aud_tuple_get_string(from_tuple, FIELD_FILE_NAME, NULL)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
173 tr->duration = (uint32_t)aud_tuple_get_int(from_tuple, FIELD_LENGTH, NULL); |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
174 tr->filetype = find_filetype (filename); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
175 tr->genre = g_strdup((gchar*)aud_tuple_get_string(from_tuple, FIELD_GENRE, NULL)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
176 tr->date = g_strdup_printf("%d",aud_tuple_get_int(from_tuple, FIELD_YEAR, NULL)); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
177 g_free(filename); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
178 return tr; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
179 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
180 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
181 gint upload_file(Tuple *from_tuple) |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
182 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
183 int ret; |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
184 gchar *tmp, *from_path = NULL, *filename; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
185 uint32_t parent_id = 0; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
186 LIBMTP_track_t *gentrack; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
187 gentrack = track_metadata(from_tuple); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1702
diff
changeset
|
188 from_path = g_strdup_printf("%s/%s", aud_tuple_get_string(from_tuple, FIELD_FILE_PATH, NULL), aud_tuple_get_string(from_tuple, FIELD_FILE_NAME, NULL)); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
189 if(gentrack == NULL) return 1; |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
190 tmp = g_strescape(from_path,NULL); |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
191 filename=g_filename_from_uri(tmp,NULL,NULL); |
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
192 |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
193 g_free(from_path); |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
194 g_free(tmp); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
195 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
196 #if DEBUG |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
197 g_print("Uploading track '%s'\n",filename); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
198 #endif |
2935
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
199 #ifdef HAVE_LIBMTP_030 |
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
200 gentrack->parent_id = mtp_device->default_music_folder; |
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
201 ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL); |
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
202 #else |
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
203 parent_id = mtp_device->default_music_folder; |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
204 ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL, parent_id); |
2935
6f0eccec978e
applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
Cristi Magherusan <majeru@atheme.org>
parents:
2576
diff
changeset
|
205 #endif |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
206 LIBMTP_destroy_track_t(gentrack); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
207 if (ret == 0) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
208 g_print("Track upload finished!\n"); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
209 else |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
210 { |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
211 g_print("An error has occured while uploading '%s'...\nUpload failed!!!\n\n",filename); |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
212 mtp_initialised = FALSE; |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
213 g_free(filename); |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
214 return 1; |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
215 } |
2160
5ba49a9c053c
fixed uploads, using URI's with libmtp is bad, mmm'kay !
Cristi Magherusan <majeru@atheme-project.org>
parents:
2149
diff
changeset
|
216 g_free(filename); |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
217 return 0; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
218 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
219 |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
220 |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
221 gpointer upload(gpointer arg) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
222 { |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
223 gtk_widget_hide(mtp_submenu_item_free); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
224 if(!mutex) |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
225 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
226 gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mtp_submenu_item_up))),UP_DEFAULT_LABEL); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
227 gtk_widget_set_sensitive(mtp_submenu_item_up, TRUE); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
228 return NULL; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
229 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
230 g_mutex_lock(mutex); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
231 if(!mtp_device) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
232 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
233 gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mtp_submenu_item_up))),UP_DEFAULT_LABEL); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
234 gtk_widget_set_sensitive(mtp_submenu_item_up, TRUE); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
235 g_mutex_unlock(mutex); |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
236 return NULL; |
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
237 } |
1474
10791910b866
the label wasn't restored on failure
Cristi Magherusan <majeru@atheme-project.org>
parents:
1471
diff
changeset
|
238 |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
239 Tuple* tuple; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
240 GList *up_list=NULL,*node; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
241 node=up_list=get_upload_list(); |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
242 gint up_err=0; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
243 while(node) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
244 { |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
245 tuple=(Tuple*)(node->data); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
246 up_err = upload_file(tuple); |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
247 if(up_err ) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
248 { |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
249 /*show_dialog("An error has occured while uploading...\nUpload failed!");*/ |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
250 break; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
251 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
252 if(exiting) |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
253 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
254 /*show_dialog("Shutting down MTP while uploading.\nPending uploads were cancelled");*/ |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
255 break; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
256 } |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
257 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
258 node = g_list_next(node); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
259 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
260 g_list_free(up_list); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
261 gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mtp_submenu_item_up))),UP_DEFAULT_LABEL); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
262 gtk_widget_set_sensitive(mtp_submenu_item_up, TRUE); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
263 g_mutex_unlock(mutex); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
264 #if DEBUG |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
265 g_print("MTP upload process finished\n"); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
266 #endif |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
267 gtk_widget_show(mtp_submenu_item_free); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
268 g_thread_exit(NULL); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
269 return NULL; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
270 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
271 |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
272 gboolean mtp_press() |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
273 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
274 if(!mutex) |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
275 return TRUE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
276 g_mutex_lock(mutex); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
277 if(!mtp_initialised) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
278 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
279 #if DEBUG |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
280 g_print("Initializing the MTP device...\n"); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
281 #endif |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
282 LIBMTP_Init(); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
283 mtp_device = LIBMTP_Get_First_Device(); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
284 mtp_initialised = TRUE; |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
285 gtk_widget_show(mtp_submenu_item_free); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
286 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
287 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
288 g_mutex_unlock(mutex); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
289 if(mtp_device == NULL) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
290 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
291 #if DEBUG |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
292 g_print("No MTP devices have been found !!!\n"); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
293 #endif |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
294 /* show_dialog("No MTP devices have been found !!!"); */ |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
295 mtp_initialised = FALSE; |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
296 return TRUE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
297 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
298 } |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
299 gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mtp_submenu_item_up))), _("Upload in progress...")); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
300 gtk_widget_set_sensitive(mtp_submenu_item_up, FALSE); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
301 g_thread_create(upload,NULL,FALSE,NULL); |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
302 return TRUE; |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
303 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
304 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
305 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
306 void mtp_init(void) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
307 { |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
308 mtp_root_menuitem=gtk_menu_item_new_with_label(_("MTP device handler")); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
309 mtp_submenu=gtk_menu_new(); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
310 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
311 mtp_submenu_item_up=gtk_menu_item_new_with_label(UP_DEFAULT_LABEL); |
2180
f629e0c90f18
added basic internationalization support to mtp_up
mf0102 <0102@gmx.at>
parents:
2160
diff
changeset
|
312 mtp_submenu_item_free=gtk_menu_item_new_with_label(_("Disconnect the device")); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
313 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
314 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
315 gtk_menu_shell_append (GTK_MENU_SHELL (mtp_submenu), mtp_submenu_item_up); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
316 gtk_widget_show (mtp_submenu_item_up); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
317 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
318 gtk_menu_shell_append (GTK_MENU_SHELL (mtp_submenu), mtp_submenu_item_free); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
319 |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
320 gtk_menu_item_set_submenu(GTK_MENU_ITEM(mtp_root_menuitem),mtp_submenu); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
321 gtk_widget_show (mtp_submenu); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
322 gtk_widget_show (mtp_root_menuitem); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
323 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
324 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
325 audacious_menu_plugin_item_add(AUDACIOUS_MENU_PLAYLIST_RCLICK, mtp_root_menuitem); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
326 g_signal_connect (G_OBJECT (mtp_submenu_item_up), "button_press_event",G_CALLBACK (mtp_press), NULL); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
327 g_signal_connect (G_OBJECT (mtp_submenu_item_free), "button_press_event",G_CALLBACK (free_device), NULL); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
328 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
329 mutex = g_mutex_new(); |
1461
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
330 plugin_active = TRUE; |
1500
611d8db6b421
made it enabled by default if having libmtp, fixes Chainsaw's bug and adds some improvements
Cristi Magherusan <majeru@atheme-project.org>
parents:
1497
diff
changeset
|
331 exiting=FALSE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
332 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
333 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
334 void mtp_cleanup(void) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
335 { |
1461
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
336 if (plugin_active) |
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
337 { |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
338 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
339 #if DEBUG |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
340 if(mtp_initialised) |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
341 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
342 g_print("\n\n !!!CAUTION!!! \n\n" |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
343 "Cleaning up MTP upload plugin, please wait!!!...\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
344 "This will block until the pending tracks are uploaded,\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
345 "then it will gracefully close your device\n\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
346 "!!! FORCING SHUTDOWN NOW MAY CAUSE DAMAGE TO YOUR DEVICE !!!\n\n\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
347 "Waiting for the MTP mutex to unlock...\n"); |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
348 exiting=TRUE; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
349 } |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
350 #endif |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
351 if(mutex) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
352 g_mutex_lock(mutex); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
353 if(mtp_device!= NULL) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
354 { |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
355 LIBMTP_Release_Device(mtp_device); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
356 mtp_device = NULL; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
357 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
358 g_mutex_unlock(mutex); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
359 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
360 if(mtp_initialised) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
361 g_print("The MTP mutex has been unlocked\n"); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
362 #endif |
1517
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
363 audacious_menu_plugin_item_remove(AUDACIOUS_MENU_PLAYLIST_RCLICK, mtp_root_menuitem); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
364 gtk_widget_destroy(mtp_submenu_item_up); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
365 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
366 gtk_widget_destroy(mtp_submenu_item_up); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
367 gtk_widget_destroy(mtp_submenu_item_free); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
368 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
369 gtk_widget_destroy(mtp_submenu); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
370 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
371 gtk_widget_destroy(mtp_root_menuitem); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
372 |
1461
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
373 g_mutex_free (mutex); |
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
374 mutex = NULL; |
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
375 plugin_active = FALSE; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
376 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
377 if(mtp_initialised) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
378 g_print("MTP upload plugin has been cleaned up successfully\n"); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
379 #endif |
1461
161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
Giacomo Lozito <james@develia.org>
parents:
1458
diff
changeset
|
380 } |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
381 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
382 |