Mercurial > audlegacy-plugins
annotate src/mtp_up/mtp.c @ 1882:eed7c270e8dd
Fix MILLIONS of Makefiles.
author | Jonathan Schleifer <js@h3c.de> |
---|---|
date | Wed, 26 Sep 2007 14:53:37 +0200 |
parents | cecf5f34a671 |
children | 5fa26178eaef |
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 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
19 #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
|
20 #include <sys/types.h> |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
21 #include <libmtp.h> |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
22 #include <audacious/plugin.h> |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
23 #include <audacious/playlist.h> |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
24 #include <audacious/ui_plugin_menu.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
|
25 |
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
|
26 #include <gtk/gtk.h> |
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 #include <audacious/util.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
|
28 #include "filetype.h" |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
29 #define DEBUG 1 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
30 |
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
|
31 #define ROOT_LABEL "MTP device handler" |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
32 #define UP_DEFAULT_LABEL "Upload selected track(s)" |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
33 #define UP_BUSY_LABEL "Upload in progress..." |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
34 #define FREE_LABEL "Disconnect the device" |
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 void mtp_prefs ( void ); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
47 void mtp_about ( void ); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
48 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
49 GeneralPlugin mtp_gp = |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
50 { |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
51 NULL, /* handle */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
52 NULL, /* filename */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
53 "MTP Upload " , /* description */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
54 mtp_init, /* init */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
55 mtp_about, /* about */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
56 mtp_prefs, /* configure */ |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
57 mtp_cleanup /* cleanup */ |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
58 }; |
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
|
59 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
|
60 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
61 GeneralPlugin *mtp_gplist[] = { &mtp_gp, NULL }; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
62 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
|
63 |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
64 |
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
|
65 void show_dialog(const gchar* message) |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
66 { |
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
|
67 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
|
68 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
|
69 GTK_DIALOG_MODAL, |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
70 GTK_MESSAGE_ERROR, |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
71 GTK_BUTTONS_OK, |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
72 message); |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
73 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
|
74 gtk_widget_show(dialog); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
75 /* 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
|
76 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
|
77 |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
78 } |
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
79 |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
80 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
|
81 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
82 #if DEBUG |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
83 if(mtp_initialised) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
84 g_print("\n\n !!!CAUTION!!! \n\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
85 "Cleaning up MTP upload plugin, please wait!!!...\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
86 "This will block until the pending tracks are uploaded,\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
87 "then it will gracefully close your device\n\n" |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
88 "!!! 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
|
89 "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
|
90 #endif |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
91 if(!mutex) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
92 return TRUE; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
93 g_mutex_lock(mutex); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
94 if(mtp_device!= NULL) |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
95 { |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
96 LIBMTP_Release_Device(mtp_device); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
97 mtp_device = NULL; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
98 mtp_initialised = FALSE; |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
99 gtk_widget_hide(mtp_submenu_item_free); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
100 } |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
101 g_mutex_unlock(mutex); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
102 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
|
103 } |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
104 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
105 GList * get_upload_list() |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
106 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
107 Tuple *tuple; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
108 GList *node=NULL,*up_list=NULL; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
109 PlaylistEntry *entry; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
110 Playlist *current_play = playlist_get_active(); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
111 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
112 node = current_play->entries; |
1675
ae9b0327b620
Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
113 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
|
114 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
|
115 { |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
116 entry = PLAYLIST_ENTRY(node->data); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
117 if (entry->selected) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
118 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
119 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
|
120 up_list=g_list_prepend(up_list,tuple); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
121 entry->selected = FALSE; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
122 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
123 node = g_list_next(node); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
124 } |
1675
ae9b0327b620
Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
125 PLAYLIST_UNLOCK(current_play); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
126 return g_list_reverse(up_list); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
127 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
128 |
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
|
129 LIBMTP_track_t *track_metadata(Tuple *from_tuple) |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
130 { |
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
|
131 LIBMTP_track_t *tr; |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
132 gchar *filename, *from_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
|
133 VFSFile *f; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
134 uint64_t filesize; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
135 uint32_t parent_id = 0; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
136 struct stat sb; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
137 |
1702
cecf5f34a671
Oops, one argument for tuple_get_string() was missing, fixed. Pointed out by
Matti Hamalainen <ccr@tnsp.org>
parents:
1697
diff
changeset
|
138 from_path = g_strdup_printf("%s/%s", tuple_get_string(from_tuple, FIELD_FILE_PATH, NULL), 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
|
139 gchar *tmp; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
140 tmp = g_strescape(from_path,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
|
141 filename=g_filename_from_uri(tmp,NULL,NULL); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
142 /* 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
|
143 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
|
144 { |
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 f = vfs_fopen(from_path,"r"); |
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 if(vfs_is_streaming(f)) |
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 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
148 vfs_fclose(f); |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
149 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
|
150 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
151 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
152 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
153 if ( stat(from_path, &sb) == -1 ) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
154 { |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
155 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
156 g_print("ERROR! encountered while stat()'ing \"%s\"\n",from_path); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
157 #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
|
158 return NULL; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
159 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
160 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
|
161 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
|
162 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
163 /* 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
|
164 tr = LIBMTP_new_track_t(); |
1696
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
165 tr->title = g_strdup((gchar*) tuple_get_string(from_tuple, FIELD_TITLE, NULL)); |
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
166 tr->artist = g_strdup((gchar*) tuple_get_string(from_tuple, FIELD_ARTIST, NULL)); |
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
167 tr->album = g_strdup((gchar*)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
|
168 tr->filesize = filesize; |
1696
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
169 tr->filename = g_strdup(tuple_get_string(from_tuple, FIELD_FILE_NAME, NULL)); |
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
170 tr->duration = (uint32_t)tuple_get_int(from_tuple, FIELD_LENGTH, 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->filetype = find_filetype (from_path); |
1696
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
172 tr->genre = g_strdup((gchar*)tuple_get_string(from_tuple, FIELD_GENRE, NULL)); |
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
173 tr->date = g_strdup_printf("%d",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
|
174 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
|
175 g_free(from_path); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
176 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
|
177 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
|
178 } |
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 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
|
181 { |
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 int ret; |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
183 gchar *comp, *from_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
|
184 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
|
185 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
|
186 gentrack = track_metadata(from_tuple); |
1696
1ac047826c64
Fix some tuple function calls to conform with new API.
Matti Hamalainen <ccr@tnsp.org>
parents:
1522
diff
changeset
|
187 from_path = g_strdup_printf("%s/%s", tuple_get_string(from_tuple, FIELD_FILE_PATH, NULL), 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
|
188 if(gentrack == NULL) return 1; |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
189 comp = g_strescape(from_path,NULL); |
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
190 g_free(from_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
|
191 parent_id = mtp_device->default_music_folder; |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
192 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
193 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
194 g_print("Uploading track '%s'\n",comp); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
195 #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
|
196 ret = LIBMTP_Send_Track_From_File(mtp_device, comp , gentrack, NULL , NULL, parent_id); |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
197 LIBMTP_destroy_track_t(gentrack); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
198 g_free(comp); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
199 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
|
200 g_print("Track upload finished!\n"); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
201 else |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
202 { |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
203 g_print("An error has occured while uploading '%s'...\nUpload failed!!!\n\n",comp); |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
204 mtp_initialised = FALSE; |
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
|
205 return 1; |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
206 } |
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
|
207 |
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
|
208 return 0; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
209 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
210 |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
211 |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
212 gpointer upload(gpointer arg) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
213 { |
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
|
214 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
|
215 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
|
216 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
221 g_mutex_lock(mutex); |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
222 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
|
223 { |
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 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
|
225 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
|
226 g_mutex_unlock(mutex); |
1494
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
227 return NULL; |
63144ea14b50
handling device disconnected errors
Cristi Magherusan <majeru@atheme-project.org>
parents:
1491
diff
changeset
|
228 } |
1474
10791910b866
the label wasn't restored on failure
Cristi Magherusan <majeru@atheme-project.org>
parents:
1471
diff
changeset
|
229 |
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
|
230 Tuple* tuple; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
231 GList *up_list=NULL,*node; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
232 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
|
233 gint up_err=0; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
234 while(node) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
235 { |
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
|
236 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
|
237 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
|
238 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
|
239 { |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
240 /*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
|
241 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
|
242 } |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
243 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
|
244 { |
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 /*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
|
246 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
|
247 } |
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
|
248 |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
249 node = g_list_next(node); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
250 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
251 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
|
252 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
|
253 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
|
254 g_mutex_unlock(mutex); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
255 #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
|
256 g_print("MTP upload process finished\n"); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
257 #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
|
258 gtk_widget_show(mtp_submenu_item_free); |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
259 g_thread_exit(NULL); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
260 return NULL; |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
261 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
262 |
1474
10791910b866
the label wasn't restored on failure
Cristi Magherusan <majeru@atheme-project.org>
parents:
1471
diff
changeset
|
263 void mtp_prefs ( void ) |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
264 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
265 /*pref stub*/ |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
266 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
267 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
268 |
1474
10791910b866
the label wasn't restored on failure
Cristi Magherusan <majeru@atheme-project.org>
parents:
1471
diff
changeset
|
269 void mtp_about ( void ) |
1456
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 /*about stub*/ |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
272 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
273 |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
274 gboolean mtp_press() |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
275 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
276 if(!mutex) |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
277 return TRUE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
278 g_mutex_lock(mutex); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
279 if(!mtp_initialised) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
280 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
281 #if DEBUG |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
282 g_print("Initializing the MTP device...\n"); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
283 #endif |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
284 LIBMTP_Init(); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
285 mtp_device = LIBMTP_Get_First_Device(); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
286 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
|
287 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
|
288 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
289 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
290 g_mutex_unlock(mutex); |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
291 if(mtp_device == NULL) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
292 { |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
293 #if DEBUG |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
294 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
|
295 #endif |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
296 /* 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
|
297 mtp_initialised = FALSE; |
1518
abdb27a70322
now i'm free'ing the metadata struct
Cristi Magherusan <majeru@atheme-project.org>
parents:
1517
diff
changeset
|
298 return TRUE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
299 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
300 } |
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
|
301 gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mtp_submenu_item_up))),UP_BUSY_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
|
302 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
|
303 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
|
304 return TRUE; |
1497
318e3bcdf51d
some fixes, more debug info
Cristi Magherusan <majeru@atheme-project.org>
parents:
1495
diff
changeset
|
305 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
306 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
307 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
308 void mtp_init(void) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
309 { |
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
|
310 mtp_root_menuitem=gtk_menu_item_new_with_label(ROOT_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
|
311 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
|
312 |
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 mtp_submenu_item_up=gtk_menu_item_new_with_label(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
|
314 mtp_submenu_item_free=gtk_menu_item_new_with_label(FREE_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
|
315 |
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 |
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 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
|
318 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
|
319 |
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_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
|
321 |
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
|
322 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
|
323 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
|
324 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
|
325 |
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 |
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 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
|
328 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
|
329 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
|
330 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
331 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
|
332 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
|
333 exiting=FALSE; |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
334 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
335 |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
336 void mtp_cleanup(void) |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
337 { |
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
|
338 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
|
339 { |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
340 |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
341 #if DEBUG |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
342 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
|
343 { |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
344 g_print("\n\n !!!CAUTION!!! \n\n" |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
345 "Cleaning up MTP upload plugin, please wait!!!...\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
346 "This will block until the pending tracks are uploaded,\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
347 "then it will gracefully close your device\n\n" |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
348 "!!! 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
|
349 "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
|
350 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
|
351 } |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
352 #endif |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
353 if(mutex) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
354 g_mutex_lock(mutex); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
355 if(mtp_device!= NULL) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
356 { |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
357 LIBMTP_Release_Device(mtp_device); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
358 mtp_device = NULL; |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
359 } |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
360 g_mutex_unlock(mutex); |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
361 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
362 if(mtp_initialised) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
363 g_print("The MTP mutex has been unlocked\n"); |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
364 #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
|
365 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
|
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 |
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 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
|
369 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
|
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_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
|
372 |
d72a44fdb6a3
switched to uploading tracks instead of files, added disconnect option, other misc. fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1500
diff
changeset
|
373 gtk_widget_destroy(mtp_root_menuitem); |
1522
88f5ba93f3dd
fixed filename
Cristi Magherusan <majeru@atheme-project.org>
parents:
1518
diff
changeset
|
374 |
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
|
375 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
|
376 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
|
377 plugin_active = FALSE; |
1468
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
378 #if DEBUG |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
379 if(mtp_initialised) |
159186076d9a
lots of fixes
Cristi Magherusan <majeru@atheme-project.org>
parents:
1461
diff
changeset
|
380 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
|
381 #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
|
382 } |
1456
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
383 } |
475eac76a8ba
MTP upload plugin
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff
changeset
|
384 |