Merge lp:~jeremywootten/pantheon-files/dropbox-updated-for-loki into lp:~elementary-apps/pantheon-files/pantheon-files-plugin-dropbox
- dropbox-updated-for-loki
- Merge into pantheon-files-plugin-dropbox
Proposed by
Jeremy Wootten
Status: | Merged |
---|---|
Approved by: | Zisu Andrei |
Approved revision: | 26 |
Merged at revision: | 24 |
Proposed branch: | lp:~jeremywootten/pantheon-files/dropbox-updated-for-loki |
Merge into: | lp:~elementary-apps/pantheon-files/pantheon-files-plugin-dropbox |
Prerequisite: | lp:~jeremywootten/pantheon-files/dropbox-plugin-reformat-for-loki |
Diff against target: |
1148 lines (+180/-347) 10 files modified
CMakeLists.txt (+7/-8) dropbox-client.c (+7/-7) dropbox-client.h (+1/-1) dropbox-command-client.c (+15/-15) dropbox-command-client.h (+7/-7) dropbox-hooks.c (+11/-11) dropbox-hooks.h (+20/-20) dropbox.plug (+1/-1) plugin.c (+93/-254) plugin.h (+18/-23) |
To merge this branch: | bzr merge lp:~jeremywootten/pantheon-files/dropbox-updated-for-loki |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zisu Andrei (community) | Approve | ||
Review via email: mp+298094@code.launchpad.net |
Commit message
Namespace changes for dropbox plugin
Description of the change
This branch is built on lp:~jeremywootten/pantheon-files/dropbox-plugin-reformat-for-loki.
The code is updated to be compatible with Loki. Some namespaces are changed from marlin to pantheon-files or PF. Emblem names are updated.
To post a comment you must log in.
- 25. By Jeremy Wootten
-
Do not link unnecessarily to pantheon-
files-widgets - 26. By Jeremy Wootten
-
Merge changes from parent
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2016-06-24 12:59:58 +0000 | |||
3 | +++ CMakeLists.txt 2016-06-24 12:59:58 +0000 | |||
4 | @@ -2,9 +2,9 @@ | |||
5 | 2 | 2 | ||
6 | 3 | cmake_minimum_required (VERSION 2.6) | 3 | cmake_minimum_required (VERSION 2.6) |
7 | 4 | cmake_policy(VERSION 2.6) | 4 | cmake_policy(VERSION 2.6) |
9 | 5 | project(Marlin-Dropbox) | 5 | project(Pantheon-Files-Dropbox) |
10 | 6 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) | 6 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) |
12 | 7 | set(GETTEXT_PACKAGE "marlin-dropbox") | 7 | set(GETTEXT_PACKAGE "pantheon-files-dropbox") |
13 | 8 | set(PACKAGE_VERSION 0.1) | 8 | set(PACKAGE_VERSION 0.1) |
14 | 9 | set(VERSION 0.1) | 9 | set(VERSION 0.1) |
15 | 10 | configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) | 10 | configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) |
16 | @@ -13,9 +13,9 @@ | |||
17 | 13 | find_package(PkgConfig) | 13 | find_package(PkgConfig) |
18 | 14 | pkg_check_modules(DROPBOX REQUIRED | 14 | pkg_check_modules(DROPBOX REQUIRED |
19 | 15 | gtk+-3.0 | 15 | gtk+-3.0 |
21 | 16 | gee-1.0 | 16 | gee-0.8 |
22 | 17 | glib-2.0 | 17 | glib-2.0 |
24 | 18 | marlincore | 18 | pantheon-files-core |
25 | 19 | ) | 19 | ) |
26 | 20 | set(CFLAGS | 20 | set(CFLAGS |
27 | 21 | ${DROPBOX_CFLAGS} ${DROPBOX_CFLAGS_OTHER} | 21 | ${DROPBOX_CFLAGS} ${DROPBOX_CFLAGS_OTHER} |
28 | @@ -25,8 +25,7 @@ | |||
29 | 25 | include_directories(${CMAKE_BINARY_DIR}/libcore/) | 25 | include_directories(${CMAKE_BINARY_DIR}/libcore/) |
30 | 26 | add_definitions(${CFLAGS}) | 26 | add_definitions(${CFLAGS}) |
31 | 27 | link_directories(${LIB_PATHS}) | 27 | link_directories(${LIB_PATHS}) |
33 | 28 | add_library(marlin-dropbox SHARED | 28 | add_library(pantheon-files-dropbox SHARED |
34 | 29 | plugin.c dropbox-client-util.c dropbox-command-client.c dropbox-client.c dropbox-hooks.c) | 29 | plugin.c dropbox-client-util.c dropbox-command-client.c dropbox-client.c dropbox-hooks.c) |
38 | 30 | target_link_libraries(marlin-dropbox marlincore marlinwidgets ${DROPBOX_LIBRARIES}) | 30 | target_link_libraries(pantheon-files-dropbox pantheon-files-core ${DROPBOX_LIBRARIES}) |
39 | 31 | install(TARGETS marlin-dropbox DESTINATION lib/pantheon-files/plugins/) | 31 | install(TARGETS pantheon-files-dropbox DESTINATION lib/pantheon-files/plugins/) |
37 | 32 | |||
40 | 33 | 32 | ||
41 | === modified file 'dropbox-client.c' | |||
42 | --- dropbox-client.c 2016-06-24 12:59:58 +0000 | |||
43 | +++ dropbox-client.c 2016-06-24 12:59:58 +0000 | |||
44 | @@ -62,7 +62,7 @@ | |||
45 | 62 | dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; | 62 | dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; |
46 | 63 | } | 63 | } |
47 | 64 | else { | 64 | else { |
49 | 65 | marlin_dropbox_hooks_force_reconnect(&(dc->hookserv)); | 65 | pf_dropbox_hooks_force_reconnect(&(dc->hookserv)); |
50 | 66 | } | 66 | } |
51 | 67 | } | 67 | } |
52 | 68 | 68 | ||
53 | @@ -84,7 +84,7 @@ | |||
54 | 84 | gboolean | 84 | gboolean |
55 | 85 | dropbox_client_is_connected(DropboxClient *dc) { | 85 | dropbox_client_is_connected(DropboxClient *dc) { |
56 | 86 | return (dropbox_command_client_is_connected(&(dc->dcc)) && | 86 | return (dropbox_command_client_is_connected(&(dc->dcc)) && |
58 | 87 | marlin_dropbox_hooks_is_connected(&(dc->hookserv))); | 87 | pf_dropbox_hooks_is_connected(&(dc->hookserv))); |
59 | 88 | } | 88 | } |
60 | 89 | 89 | ||
61 | 90 | void | 90 | void |
62 | @@ -92,14 +92,14 @@ | |||
63 | 92 | if (dropbox_client_is_connected(dc) == TRUE) { | 92 | if (dropbox_client_is_connected(dc) == TRUE) { |
64 | 93 | debug("forcing client to reconnect"); | 93 | debug("forcing client to reconnect"); |
65 | 94 | dropbox_command_client_force_reconnect(&(dc->dcc)); | 94 | dropbox_command_client_force_reconnect(&(dc->dcc)); |
67 | 95 | marlin_dropbox_hooks_force_reconnect(&(dc->hookserv)); | 95 | pf_dropbox_hooks_force_reconnect(&(dc->hookserv)); |
68 | 96 | } | 96 | } |
69 | 97 | } | 97 | } |
70 | 98 | 98 | ||
71 | 99 | /* should only be called once on initialization */ | 99 | /* should only be called once on initialization */ |
72 | 100 | void | 100 | void |
73 | 101 | dropbox_client_setup(DropboxClient *dc) { | 101 | dropbox_client_setup(DropboxClient *dc) { |
75 | 102 | marlin_dropbox_hooks_setup(&(dc->hookserv)); | 102 | pf_dropbox_hooks_setup(&(dc->hookserv)); |
76 | 103 | dropbox_command_client_setup(&(dc->dcc)); | 103 | dropbox_command_client_setup(&(dc->dcc)); |
77 | 104 | 104 | ||
78 | 105 | g_hook_list_init(&(dc->ondisconnect_hooklist), sizeof(GHook)); | 105 | g_hook_list_init(&(dc->ondisconnect_hooklist), sizeof(GHook)); |
79 | @@ -108,7 +108,7 @@ | |||
80 | 108 | dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; | 108 | dc->hook_disconnect_called = dc->command_disconnect_called = FALSE; |
81 | 109 | dc->hook_connect_called = dc->command_connect_called = FALSE; | 109 | dc->hook_connect_called = dc->command_connect_called = FALSE; |
82 | 110 | 110 | ||
84 | 111 | marlin_dropbox_hooks_add_on_connect_hook(&(dc->hookserv), | 111 | pf_dropbox_hooks_add_on_connect_hook(&(dc->hookserv), |
85 | 112 | (DropboxHookClientConnectHook) | 112 | (DropboxHookClientConnectHook) |
86 | 113 | hook_on_connect, dc); | 113 | hook_on_connect, dc); |
87 | 114 | 114 | ||
88 | @@ -116,7 +116,7 @@ | |||
89 | 116 | (DropboxCommandClientConnectHook) | 116 | (DropboxCommandClientConnectHook) |
90 | 117 | command_on_connect, dc); | 117 | command_on_connect, dc); |
91 | 118 | 118 | ||
93 | 119 | marlin_dropbox_hooks_add_on_disconnect_hook(&(dc->hookserv), | 119 | pf_dropbox_hooks_add_on_disconnect_hook(&(dc->hookserv), |
94 | 120 | (DropboxHookClientConnectHook) | 120 | (DropboxHookClientConnectHook) |
95 | 121 | hook_on_disconnect, dc); | 121 | hook_on_disconnect, dc); |
96 | 122 | 122 | ||
97 | @@ -168,6 +168,6 @@ | |||
98 | 168 | void | 168 | void |
99 | 169 | dropbox_client_start(DropboxClient *dc) { | 169 | dropbox_client_start(DropboxClient *dc) { |
100 | 170 | debug("starting connections"); | 170 | debug("starting connections"); |
102 | 171 | marlin_dropbox_hooks_start(&(dc->hookserv)); | 171 | pf_dropbox_hooks_start(&(dc->hookserv)); |
103 | 172 | dropbox_command_client_start(&(dc->dcc)); | 172 | dropbox_command_client_start(&(dc->dcc)); |
104 | 173 | } | 173 | } |
105 | 174 | 174 | ||
106 | === modified file 'dropbox-client.h' | |||
107 | --- dropbox-client.h 2016-06-24 12:59:58 +0000 | |||
108 | +++ dropbox-client.h 2016-06-24 12:59:58 +0000 | |||
109 | @@ -32,7 +32,7 @@ | |||
110 | 32 | 32 | ||
111 | 33 | typedef struct { | 33 | typedef struct { |
112 | 34 | DropboxCommandClient dcc; | 34 | DropboxCommandClient dcc; |
114 | 35 | MarlinDropboxHookserv hookserv; | 35 | PFDropboxHookserv hookserv; |
115 | 36 | GHookList onconnect_hooklist; | 36 | GHookList onconnect_hooklist; |
116 | 37 | GHookList ondisconnect_hooklist; | 37 | GHookList ondisconnect_hooklist; |
117 | 38 | gboolean hook_connect_called; | 38 | gboolean hook_connect_called; |
118 | 39 | 39 | ||
119 | === modified file 'dropbox-command-client.c' | |||
120 | --- dropbox-command-client.c 2016-06-24 12:59:58 +0000 | |||
121 | +++ dropbox-command-client.c 2016-06-24 12:59:58 +0000 | |||
122 | @@ -47,7 +47,7 @@ | |||
123 | 47 | this can be cleaned up once the file_info_command isn't a special | 47 | this can be cleaned up once the file_info_command isn't a special |
124 | 48 | case anylonger | 48 | case anylonger |
125 | 49 | */ | 49 | */ |
127 | 50 | gboolean marlin_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *); | 50 | gboolean pf_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *); |
128 | 51 | 51 | ||
129 | 52 | typedef struct { | 52 | typedef struct { |
130 | 53 | DropboxCommandClient *dcc; | 53 | DropboxCommandClient *dcc; |
131 | @@ -430,7 +430,7 @@ | |||
132 | 430 | dficr->folder_tag_response = folder_tag_response; | 430 | dficr->folder_tag_response = folder_tag_response; |
133 | 431 | dficr->file_status_response = file_status_response; | 431 | dficr->file_status_response = file_status_response; |
134 | 432 | dficr->emblems_response = emblems_response; | 432 | dficr->emblems_response = emblems_response; |
136 | 433 | g_idle_add((GSourceFunc) marlin_dropbox_finish_file_info_command, dficr); | 433 | g_idle_add((GSourceFunc) pf_dropbox_finish_file_info_command, dficr); |
137 | 434 | 434 | ||
138 | 435 | g_free(filename); | 435 | g_free(filename); |
139 | 436 | 436 | ||
140 | @@ -528,7 +528,7 @@ | |||
141 | 528 | dficr->dfic = dfic; | 528 | dficr->dfic = dfic; |
142 | 529 | dficr->file_status_response = NULL; | 529 | dficr->file_status_response = NULL; |
143 | 530 | dficr->emblems_response = NULL; | 530 | dficr->emblems_response = NULL; |
145 | 531 | g_idle_add((GSourceFunc) marlin_dropbox_finish_file_info_command, dficr); | 531 | g_idle_add((GSourceFunc) pf_dropbox_finish_file_info_command, dficr); |
146 | 532 | } | 532 | } |
147 | 533 | break; | 533 | break; |
148 | 534 | case GENERAL_COMMAND: { | 534 | case GENERAL_COMMAND: { |
149 | @@ -657,9 +657,9 @@ | |||
150 | 657 | g_io_channel_set_line_term(chan, "\n", -1); | 657 | g_io_channel_set_line_term(chan, "\n", -1); |
151 | 658 | 658 | ||
152 | 659 | #define SET_CONNECTED_STATE(s) { \ | 659 | #define SET_CONNECTED_STATE(s) { \ |
154 | 660 | g_mutex_lock(dcc->command_connected_mutex); \ | 660 | g_mutex_lock(&(dcc->command_connected_mutex)); \ |
155 | 661 | dcc->command_connected = s; \ | 661 | dcc->command_connected = s; \ |
157 | 662 | g_mutex_unlock(dcc->command_connected_mutex); \ | 662 | g_mutex_unlock(&(dcc->command_connected_mutex)); \ |
158 | 663 | } | 663 | } |
159 | 664 | 664 | ||
160 | 665 | SET_CONNECTED_STATE(TRUE); | 665 | SET_CONNECTED_STATE(TRUE); |
161 | @@ -670,12 +670,12 @@ | |||
162 | 670 | DropboxCommand *dc; | 670 | DropboxCommand *dc; |
163 | 671 | 671 | ||
164 | 672 | while (1) { | 672 | while (1) { |
166 | 673 | GTimeVal gtv; | 673 | guint64 gtv; |
167 | 674 | 674 | ||
170 | 675 | g_get_current_time(>v); | 675 | gtv = g_get_real_time(); |
171 | 676 | g_time_val_add(>v, G_USEC_PER_SEC / 10); | 676 | gtv = gtv + G_USEC_PER_SEC / 10; |
172 | 677 | /* get a request from nautilus */ | 677 | /* get a request from nautilus */ |
174 | 678 | dc = g_async_queue_timed_pop(dcc->command_queue, >v); | 678 | dc = g_async_queue_timeout_pop(dcc->command_queue, gtv); |
175 | 679 | if (dc != NULL) { | 679 | if (dc != NULL) { |
176 | 680 | break; | 680 | break; |
177 | 681 | } | 681 | } |
178 | @@ -747,9 +747,9 @@ | |||
179 | 747 | dropbox_command_client_is_connected(DropboxCommandClient *dcc) { | 747 | dropbox_command_client_is_connected(DropboxCommandClient *dcc) { |
180 | 748 | gboolean command_connected; | 748 | gboolean command_connected; |
181 | 749 | 749 | ||
183 | 750 | g_mutex_lock(dcc->command_connected_mutex); | 750 | g_mutex_lock(&(dcc->command_connected_mutex)); |
184 | 751 | command_connected = dcc->command_connected; | 751 | command_connected = dcc->command_connected; |
186 | 752 | g_mutex_unlock(dcc->command_connected_mutex); | 752 | g_mutex_unlock(&(dcc->command_connected_mutex)); |
187 | 753 | 753 | ||
188 | 754 | return command_connected; | 754 | return command_connected; |
189 | 755 | } | 755 | } |
190 | @@ -772,7 +772,7 @@ | |||
191 | 772 | void | 772 | void |
192 | 773 | dropbox_command_client_setup(DropboxCommandClient *dcc) { | 773 | dropbox_command_client_setup(DropboxCommandClient *dcc) { |
193 | 774 | dcc->command_queue = g_async_queue_new(); | 774 | dcc->command_queue = g_async_queue_new(); |
195 | 775 | dcc->command_connected_mutex = g_mutex_new(); | 775 | g_mutex_init(&(dcc->command_connected_mutex)); |
196 | 776 | dcc->command_connected = FALSE; | 776 | dcc->command_connected = FALSE; |
197 | 777 | dcc->ca_hooklist = NULL; | 777 | dcc->ca_hooklist = NULL; |
198 | 778 | 778 | ||
199 | @@ -826,8 +826,8 @@ | |||
200 | 826 | dropbox_command_client_start(DropboxCommandClient *dcc) { | 826 | dropbox_command_client_start(DropboxCommandClient *dcc) { |
201 | 827 | /* setup the connect to the command server */ | 827 | /* setup the connect to the command server */ |
202 | 828 | debug("starting command thread"); | 828 | debug("starting command thread"); |
205 | 829 | g_thread_create((gpointer (*)(gpointer data)) dropbox_command_client_thread, | 829 | g_thread_new("pantheon-files-plugin-dropbox", (gpointer (*)(gpointer data)) dropbox_command_client_thread, |
206 | 830 | dcc, FALSE, NULL); | 830 | dcc); |
207 | 831 | } | 831 | } |
208 | 832 | 832 | ||
209 | 833 | /* thread safe */ | 833 | /* thread safe */ |
210 | @@ -850,7 +850,7 @@ | |||
211 | 850 | /* this is the C API, there is another send_command_to_db | 850 | /* this is the C API, there is another send_command_to_db |
212 | 851 | that is more the actual over the wire command */ | 851 | that is more the actual over the wire command */ |
213 | 852 | void dropbox_command_client_send_command(DropboxCommandClient *dcc, | 852 | void dropbox_command_client_send_command(DropboxCommandClient *dcc, |
215 | 853 | MarlinDropboxCommandResponseHandler h, | 853 | PFDropboxCommandResponseHandler h, |
216 | 854 | gpointer ud, | 854 | gpointer ud, |
217 | 855 | const char *command, ...) { | 855 | const char *command, ...) { |
218 | 856 | va_list ap; | 856 | va_list ap; |
219 | 857 | 857 | ||
220 | === modified file 'dropbox-command-client.h' | |||
221 | --- dropbox-command-client.h 2016-06-24 12:59:58 +0000 | |||
222 | +++ dropbox-command-client.h 2016-06-24 12:59:58 +0000 | |||
223 | @@ -24,16 +24,16 @@ | |||
224 | 24 | #ifndef DROPBOX_COMMAND_CLIENT_H | 24 | #ifndef DROPBOX_COMMAND_CLIENT_H |
225 | 25 | #define DROPBOX_COMMAND_CLIENT_H | 25 | #define DROPBOX_COMMAND_CLIENT_H |
226 | 26 | 26 | ||
228 | 27 | #include <marlincore.h> | 27 | #include <pantheon-files-core.h> |
229 | 28 | #include <gof-file.h> | 28 | #include <gof-file.h> |
230 | 29 | 29 | ||
231 | 30 | G_BEGIN_DECLS | 30 | G_BEGIN_DECLS |
232 | 31 | 31 | ||
233 | 32 | /* command structs */ | 32 | /* command structs */ |
235 | 33 | typedef enum {GET_FILE_INFO, GENERAL_COMMAND} MarlinDropboxRequestType; | 33 | typedef enum {GET_FILE_INFO, GENERAL_COMMAND} PFDropboxRequestType; |
236 | 34 | 34 | ||
237 | 35 | typedef struct { | 35 | typedef struct { |
239 | 36 | MarlinDropboxRequestType request_type; | 36 | PFDropboxRequestType request_type; |
240 | 37 | } DropboxCommand; | 37 | } DropboxCommand; |
241 | 38 | 38 | ||
242 | 39 | typedef struct { | 39 | typedef struct { |
243 | @@ -51,13 +51,13 @@ | |||
244 | 51 | GHashTable *emblems_response; | 51 | GHashTable *emblems_response; |
245 | 52 | } DropboxFileInfoCommandResponse; | 52 | } DropboxFileInfoCommandResponse; |
246 | 53 | 53 | ||
248 | 54 | typedef void (*MarlinDropboxCommandResponseHandler)(GHashTable *, gpointer); | 54 | typedef void (*PFDropboxCommandResponseHandler)(GHashTable *, gpointer); |
249 | 55 | 55 | ||
250 | 56 | typedef struct { | 56 | typedef struct { |
251 | 57 | DropboxCommand dc; | 57 | DropboxCommand dc; |
252 | 58 | gchar *command_name; | 58 | gchar *command_name; |
253 | 59 | GHashTable *command_args; | 59 | GHashTable *command_args; |
255 | 60 | MarlinDropboxCommandResponseHandler handler; | 60 | PFDropboxCommandResponseHandler handler; |
256 | 61 | gpointer handler_ud; | 61 | gpointer handler_ud; |
257 | 62 | } DropboxGeneralCommand; | 62 | } DropboxGeneralCommand; |
258 | 63 | 63 | ||
259 | @@ -65,7 +65,7 @@ | |||
260 | 65 | typedef GHookFunc DropboxCommandClientConnectHook; | 65 | typedef GHookFunc DropboxCommandClientConnectHook; |
261 | 66 | 66 | ||
262 | 67 | typedef struct { | 67 | typedef struct { |
264 | 68 | GMutex *command_connected_mutex; | 68 | GMutex command_connected_mutex; |
265 | 69 | gboolean command_connected; | 69 | gboolean command_connected; |
266 | 70 | GAsyncQueue *command_queue; | 70 | GAsyncQueue *command_queue; |
267 | 71 | GList *ca_hooklist; | 71 | GList *ca_hooklist; |
268 | @@ -90,7 +90,7 @@ | |||
269 | 90 | const char *command); | 90 | const char *command); |
270 | 91 | 91 | ||
271 | 92 | void dropbox_command_client_send_command(DropboxCommandClient *dcc, | 92 | void dropbox_command_client_send_command(DropboxCommandClient *dcc, |
273 | 93 | MarlinDropboxCommandResponseHandler h, | 93 | PFDropboxCommandResponseHandler h, |
274 | 94 | gpointer ud, | 94 | gpointer ud, |
275 | 95 | const char *command, ...); | 95 | const char *command, ...); |
276 | 96 | void | 96 | void |
277 | 97 | 97 | ||
278 | === modified file 'dropbox-hooks.c' | |||
279 | --- dropbox-hooks.c 2016-06-24 12:59:58 +0000 | |||
280 | +++ dropbox-hooks.c 2016-06-24 12:59:58 +0000 | |||
281 | @@ -43,12 +43,12 @@ | |||
282 | 43 | } HookData; | 43 | } HookData; |
283 | 44 | 44 | ||
284 | 45 | static gboolean | 45 | static gboolean |
286 | 46 | try_to_connect(MarlinDropboxHookserv *hookserv); | 46 | try_to_connect(PFDropboxHookserv *hookserv); |
287 | 47 | 47 | ||
288 | 48 | static gboolean | 48 | static gboolean |
289 | 49 | handle_hook_server_input(GIOChannel *chan, | 49 | handle_hook_server_input(GIOChannel *chan, |
290 | 50 | GIOCondition cond, | 50 | GIOCondition cond, |
292 | 51 | MarlinDropboxHookserv *hookserv) { | 51 | PFDropboxHookserv *hookserv) { |
293 | 52 | /*debug_enter(); */ | 52 | /*debug_enter(); */ |
294 | 53 | 53 | ||
295 | 54 | /* we have some sweet macros defined that allow us to write this | 54 | /* we have some sweet macros defined that allow us to write this |
296 | @@ -123,7 +123,7 @@ | |||
297 | 123 | } | 123 | } |
298 | 124 | 124 | ||
299 | 125 | static void | 125 | static void |
301 | 126 | watch_killer(MarlinDropboxHookserv *hookserv) { | 126 | watch_killer(PFDropboxHookserv *hookserv) { |
302 | 127 | debug("hook client disconnected"); | 127 | debug("hook client disconnected"); |
303 | 128 | 128 | ||
304 | 129 | hookserv->connected = FALSE; | 129 | hookserv->connected = FALSE; |
305 | @@ -152,7 +152,7 @@ | |||
306 | 152 | } | 152 | } |
307 | 153 | 153 | ||
308 | 154 | static gboolean | 154 | static gboolean |
310 | 155 | try_to_connect(MarlinDropboxHookserv *hookserv) { | 155 | try_to_connect(PFDropboxHookserv *hookserv) { |
311 | 156 | /* create socket */ | 156 | /* create socket */ |
312 | 157 | hookserv->socket = socket(PF_UNIX, SOCK_STREAM, 0); | 157 | hookserv->socket = socket(PF_UNIX, SOCK_STREAM, 0); |
313 | 158 | 158 | ||
314 | @@ -258,7 +258,7 @@ | |||
315 | 258 | 258 | ||
316 | 259 | /* should only be called in glib main loop */ | 259 | /* should only be called in glib main loop */ |
317 | 260 | /* returns a gboolean because it is a GSourceFunc */ | 260 | /* returns a gboolean because it is a GSourceFunc */ |
319 | 261 | gboolean marlin_dropbox_hooks_force_reconnect(MarlinDropboxHookserv *hookserv) { | 261 | gboolean pf_dropbox_hooks_force_reconnect(PFDropboxHookserv *hookserv) { |
320 | 262 | debug_enter(); | 262 | debug_enter(); |
321 | 263 | 263 | ||
322 | 264 | if (hookserv->connected == FALSE) { | 264 | if (hookserv->connected == FALSE) { |
323 | @@ -280,12 +280,12 @@ | |||
324 | 280 | } | 280 | } |
325 | 281 | 281 | ||
326 | 282 | gboolean | 282 | gboolean |
328 | 283 | marlin_dropbox_hooks_is_connected(MarlinDropboxHookserv *hookserv) { | 283 | pf_dropbox_hooks_is_connected(PFDropboxHookserv *hookserv) { |
329 | 284 | return hookserv->connected; | 284 | return hookserv->connected; |
330 | 285 | } | 285 | } |
331 | 286 | 286 | ||
332 | 287 | void | 287 | void |
334 | 288 | marlin_dropbox_hooks_setup(MarlinDropboxHookserv *hookserv) { | 288 | pf_dropbox_hooks_setup(PFDropboxHookserv *hookserv) { |
335 | 289 | hookserv->dispatch_table = g_hash_table_new_full((GHashFunc) g_str_hash, | 289 | hookserv->dispatch_table = g_hash_table_new_full((GHashFunc) g_str_hash, |
336 | 290 | (GEqualFunc) g_str_equal, | 290 | (GEqualFunc) g_str_equal, |
337 | 291 | g_free, g_free); | 291 | g_free, g_free); |
338 | @@ -296,7 +296,7 @@ | |||
339 | 296 | } | 296 | } |
340 | 297 | 297 | ||
341 | 298 | void | 298 | void |
343 | 299 | marlin_dropbox_hooks_add_on_disconnect_hook(MarlinDropboxHookserv *hookserv, | 299 | pf_dropbox_hooks_add_on_disconnect_hook(PFDropboxHookserv *hookserv, |
344 | 300 | DropboxHookClientConnectHook dhcch, | 300 | DropboxHookClientConnectHook dhcch, |
345 | 301 | gpointer ud) { | 301 | gpointer ud) { |
346 | 302 | GHook *newhook; | 302 | GHook *newhook; |
347 | @@ -309,7 +309,7 @@ | |||
348 | 309 | } | 309 | } |
349 | 310 | 310 | ||
350 | 311 | void | 311 | void |
352 | 312 | marlin_dropbox_hooks_add_on_connect_hook(MarlinDropboxHookserv *hookserv, | 312 | pf_dropbox_hooks_add_on_connect_hook(PFDropboxHookserv *hookserv, |
353 | 313 | DropboxHookClientConnectHook dhcch, | 313 | DropboxHookClientConnectHook dhcch, |
354 | 314 | gpointer ud) { | 314 | gpointer ud) { |
355 | 315 | GHook *newhook; | 315 | GHook *newhook; |
356 | @@ -321,7 +321,7 @@ | |||
357 | 321 | g_hook_append(&(hookserv->onconnect_hooklist), newhook); | 321 | g_hook_append(&(hookserv->onconnect_hooklist), newhook); |
358 | 322 | } | 322 | } |
359 | 323 | 323 | ||
361 | 324 | void marlin_dropbox_hooks_add(MarlinDropboxHookserv *ndhs, | 324 | void pf_dropbox_hooks_add(PFDropboxHookserv *ndhs, |
362 | 325 | const gchar *hook_name, | 325 | const gchar *hook_name, |
363 | 326 | DropboxUpdateHook hook, gpointer ud) { | 326 | DropboxUpdateHook hook, gpointer ud) { |
364 | 327 | HookData *hd; | 327 | HookData *hd; |
365 | @@ -332,6 +332,6 @@ | |||
366 | 332 | } | 332 | } |
367 | 333 | 333 | ||
368 | 334 | void | 334 | void |
370 | 335 | marlin_dropbox_hooks_start(MarlinDropboxHookserv *hookserv) { | 335 | pf_dropbox_hooks_start(PFDropboxHookserv *hookserv) { |
371 | 336 | try_to_connect(hookserv); | 336 | try_to_connect(hookserv); |
372 | 337 | } | 337 | } |
373 | 338 | 338 | ||
374 | === modified file 'dropbox-hooks.h' | |||
375 | --- dropbox-hooks.h 2011-10-05 04:35:08 +0000 | |||
376 | +++ dropbox-hooks.h 2016-06-24 12:59:58 +0000 | |||
377 | @@ -21,8 +21,8 @@ | |||
378 | 21 | * | 21 | * |
379 | 22 | */ | 22 | */ |
380 | 23 | 23 | ||
383 | 24 | #ifndef MARLIN_DROPBOX_HOOKS_H | 24 | #ifndef PF_DROPBOX_HOOKS_H |
384 | 25 | #define MARLIN_DROPBOX_HOOKS_H | 25 | #define PF_DROPBOX_HOOKS_H |
385 | 26 | 26 | ||
386 | 27 | #include <glib.h> | 27 | #include <glib.h> |
387 | 28 | 28 | ||
388 | @@ -45,31 +45,31 @@ | |||
389 | 45 | GHashTable *dispatch_table; | 45 | GHashTable *dispatch_table; |
390 | 46 | GHookList ondisconnect_hooklist; | 46 | GHookList ondisconnect_hooklist; |
391 | 47 | GHookList onconnect_hooklist; | 47 | GHookList onconnect_hooklist; |
408 | 48 | } MarlinDropboxHookserv; | 48 | } PFDropboxHookserv; |
409 | 49 | 49 | ||
410 | 50 | void | 50 | void |
411 | 51 | marlin_dropbox_hooks_setup(MarlinDropboxHookserv *); | 51 | pf_dropbox_hooks_setup(PFDropboxHookserv *); |
412 | 52 | 52 | ||
413 | 53 | void | 53 | void |
414 | 54 | marlin_dropbox_hooks_start(MarlinDropboxHookserv *); | 54 | pf_dropbox_hooks_start(PFDropboxHookserv *); |
415 | 55 | 55 | ||
416 | 56 | gboolean | 56 | gboolean |
417 | 57 | marlin_dropbox_hooks_is_connected(MarlinDropboxHookserv *); | 57 | pf_dropbox_hooks_is_connected(PFDropboxHookserv *); |
418 | 58 | 58 | ||
419 | 59 | gboolean | 59 | gboolean |
420 | 60 | marlin_dropbox_hooks_force_reconnect(MarlinDropboxHookserv *); | 60 | pf_dropbox_hooks_force_reconnect(PFDropboxHookserv *); |
421 | 61 | 61 | ||
422 | 62 | void | 62 | void |
423 | 63 | marlin_dropbox_hooks_add(MarlinDropboxHookserv *ndhs, | 63 | pf_dropbox_hooks_add(PFDropboxHookserv *ndhs, |
424 | 64 | const gchar *hook_name, | 64 | const gchar *hook_name, |
425 | 65 | DropboxUpdateHook hook, gpointer ud); | 65 | DropboxUpdateHook hook, gpointer ud); |
426 | 66 | void | 66 | void |
428 | 67 | marlin_dropbox_hooks_add_on_disconnect_hook(MarlinDropboxHookserv *hookserv, | 67 | pf_dropbox_hooks_add_on_disconnect_hook(PFDropboxHookserv *hookserv, |
429 | 68 | DropboxHookClientConnectHook dhcch, | 68 | DropboxHookClientConnectHook dhcch, |
430 | 69 | gpointer ud); | 69 | gpointer ud); |
431 | 70 | 70 | ||
432 | 71 | void | 71 | void |
434 | 72 | marlin_dropbox_hooks_add_on_connect_hook(MarlinDropboxHookserv *hookserv, | 72 | pf_dropbox_hooks_add_on_connect_hook(PFDropboxHookserv *hookserv, |
435 | 73 | DropboxHookClientConnectHook dhcch, | 73 | DropboxHookClientConnectHook dhcch, |
436 | 74 | gpointer ud); | 74 | gpointer ud); |
437 | 75 | 75 | ||
438 | 76 | 76 | ||
439 | === modified file 'dropbox.plug' | |||
440 | --- dropbox.plug 2011-10-04 09:11:24 +0000 | |||
441 | +++ dropbox.plug 2016-06-24 12:59:58 +0000 | |||
442 | @@ -1,3 +1,3 @@ | |||
443 | 1 | [Plugin] | 1 | [Plugin] |
444 | 2 | Name=Dropbox | 2 | Name=Dropbox |
446 | 3 | File=libmarlin-dropbox.so | 3 | File=libpantheon-files-dropbox.so |
447 | 4 | 4 | ||
448 | === modified file 'plugin.c' | |||
449 | --- plugin.c 2016-06-24 12:59:58 +0000 | |||
450 | +++ plugin.c 2016-06-24 12:59:58 +0000 | |||
451 | @@ -1,12 +1,12 @@ | |||
452 | 1 | /* | 1 | /* |
453 | 2 | * Copyright (C) 2011 ammonkey <am.monkeyd@gmail.com> | 2 | * Copyright (C) 2011 ammonkey <am.monkeyd@gmail.com> |
454 | 3 | * | 3 | * |
456 | 4 | * Marlin is free software: you can redistribute it and/or modify it | 4 | * PantheonFiles is free software: you can redistribute it and/or modify it |
457 | 5 | * under the terms of the GNU General Public License as published by the | 5 | * under the terms of the GNU General Public License as published by the |
458 | 6 | * Free Software Foundation, either version 3 of the License, or | 6 | * Free Software Foundation, either version 3 of the License, or |
459 | 7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
460 | 8 | * | 8 | * |
462 | 9 | * Marlin is distributed in the hope that it will be useful, but | 9 | * PantheonFiles is distributed in the hope that it will be useful, but |
463 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
464 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
465 | 12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
466 | @@ -21,14 +21,10 @@ | |||
467 | 21 | #include "g-util.h" | 21 | #include "g-util.h" |
468 | 22 | #include "plugin.h" | 22 | #include "plugin.h" |
469 | 23 | 23 | ||
475 | 24 | //static gpointer marlin_dropbox_parent_class = NULL; | 24 | G_DEFINE_TYPE (PFDropbox, pf_dropbox, MARLIN_PLUGINS_TYPE_BASE); |
471 | 25 | |||
472 | 26 | //#define MARLIN_DROPBOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MARLIN_TYPE_DROPBOX, MarlinDropboxPrivate)) | ||
473 | 27 | |||
474 | 28 | G_DEFINE_TYPE (MarlinDropbox, marlin_dropbox, MARLIN_PLUGINS_TYPE_BASE); | ||
476 | 29 | 25 | ||
477 | 30 | typedef struct { | 26 | typedef struct { |
479 | 31 | MarlinDropbox *cvs; | 27 | PFDropbox *cvs; |
480 | 32 | gchar *verb; | 28 | gchar *verb; |
481 | 33 | GOFFile *file; | 29 | GOFFile *file; |
482 | 34 | } MenuCallbackData; | 30 | } MenuCallbackData; |
483 | @@ -42,22 +38,32 @@ | |||
484 | 42 | g_free (cb_data); | 38 | g_free (cb_data); |
485 | 43 | } | 39 | } |
486 | 44 | 40 | ||
492 | 45 | static char *db_emblems[] = {"dropbox-uptodate", "dropbox-syncing", "dropbox-unsyncable", "web", "people", "photos", "star"}; | 41 | static char *db_emblems[] = {"dropbox-uptodate", \ |
493 | 46 | static char *emblems[] = {"emblem-ubuntuone-synchronized", "emblem-ubuntuone-updating", "dropbox-unsyncable", "emblem-web", "emblem-people", "emblem-photos", "emblem-star"}; | 42 | "dropbox-syncing", \ |
494 | 47 | //gchar *DEFAULT_EMBLEM_PATHS[2] = { EMBLEMDIR , NULL }; | 43 | "dropbox-unsyncable", \ |
495 | 48 | 44 | "dropbox-selsync", \ | |
496 | 49 | static void marlin_dropbox_finalize (MarlinPluginsBase* obj); | 45 | "dropbox-app", \ |
497 | 46 | "web", \ | ||
498 | 47 | "people", \ | ||
499 | 48 | "photos", \ | ||
500 | 49 | "star"}; | ||
501 | 50 | |||
502 | 51 | static char *emblems[] = {"process-completed-symbolic", \ | ||
503 | 52 | "aptdaemon-upgrade", \ | ||
504 | 53 | "process-error-symbolic", \ | ||
505 | 54 | "aptdaemon-upgrade", \ | ||
506 | 55 | "dropbox-app", \ | ||
507 | 56 | "applications-internet", \ | ||
508 | 57 | "avatar-default", \ | ||
509 | 58 | "emblem-photos-symbolic", \ | ||
510 | 59 | "emblem-favorite-symbolic"}; | ||
511 | 60 | |||
512 | 61 | static void pf_dropbox_finalize (MarlinPluginsBase* obj); | ||
513 | 50 | 62 | ||
514 | 51 | static gpointer _g_object_ref0 (gpointer self) { | 63 | static gpointer _g_object_ref0 (gpointer self) { |
515 | 52 | return self ? g_object_ref (self) : NULL; | 64 | return self ? g_object_ref (self) : NULL; |
516 | 53 | } | 65 | } |
517 | 54 | 66 | ||
518 | 55 | /*static gchar* current_path = NULL; | ||
519 | 56 | static gboolean menu_added = FALSE; | ||
520 | 57 | static GSettings* settings = NULL; | ||
521 | 58 | static GList *menus = NULL; | ||
522 | 59 | static GtkWidget *menu;*/ | ||
523 | 60 | |||
524 | 61 | /* probably my favorite function */ | 67 | /* probably my favorite function */ |
525 | 62 | static gchar * | 68 | static gchar * |
526 | 63 | canonicalize_path(gchar *path) { | 69 | canonicalize_path(gchar *path) { |
527 | @@ -94,7 +100,7 @@ | |||
528 | 94 | } | 100 | } |
529 | 95 | 101 | ||
530 | 96 | gboolean | 102 | gboolean |
532 | 97 | reset_all_files(MarlinDropbox *cvs) { | 103 | reset_all_files(PFDropbox *cvs) { |
533 | 98 | /* Only run this on the main loop or you'll cause problems. */ | 104 | /* Only run this on the main loop or you'll cause problems. */ |
534 | 99 | 105 | ||
535 | 100 | /* this works because you can call a function pointer with | 106 | /* this works because you can call a function pointer with |
536 | @@ -104,7 +110,7 @@ | |||
537 | 104 | } | 110 | } |
538 | 105 | 111 | ||
539 | 106 | static void | 112 | static void |
541 | 107 | when_file_dies(MarlinDropbox *cvs, GOFFile *file) { | 113 | when_file_dies(PFDropbox *cvs, GOFFile *file) { |
542 | 108 | gchar *filename; | 114 | gchar *filename; |
543 | 109 | 115 | ||
544 | 110 | filename = g_hash_table_lookup(cvs->obj2filename, file); | 116 | filename = g_hash_table_lookup(cvs->obj2filename, file); |
545 | @@ -121,141 +127,21 @@ | |||
546 | 121 | g_hash_table_remove(cvs->obj2filename, file); | 127 | g_hash_table_remove(cvs->obj2filename, file); |
547 | 122 | } | 128 | } |
548 | 123 | 129 | ||
680 | 124 | /*****/ | 130 | |
681 | 125 | #if 0 | 131 | static void |
682 | 126 | gboolean | 132 | on_connect(PFDropbox *cvs) { |
683 | 127 | add_emblem_paths(GHashTable* emblem_paths_response) | 133 | reset_all_files(cvs); |
684 | 128 | { | 134 | } |
685 | 129 | /* Only run this on the main loop or you'll cause problems. */ | 135 | |
686 | 130 | if (!emblem_paths_response) | 136 | static void |
687 | 131 | return FALSE; | 137 | on_disconnect(PFDropbox *cvs) { |
688 | 132 | 138 | reset_all_files(cvs); | |
689 | 133 | gchar **emblem_paths_list; | 139 | } |
690 | 134 | int i; | 140 | |
691 | 135 | 141 | static void | |
692 | 136 | GtkIconTheme *theme = gtk_icon_theme_get_default(); | 142 | handle_shell_touch(GHashTable *args, PFDropbox *cvs) { |
562 | 137 | |||
563 | 138 | if (emblem_paths_response && | ||
564 | 139 | (emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"))) { | ||
565 | 140 | for (i = 0; emblem_paths_list[i] != NULL; i++) { | ||
566 | 141 | if (emblem_paths_list[i][0]) | ||
567 | 142 | gtk_icon_theme_append_search_path(theme, emblem_paths_list[i]); | ||
568 | 143 | } | ||
569 | 144 | } | ||
570 | 145 | g_hash_table_unref(emblem_paths_response); | ||
571 | 146 | return FALSE; | ||
572 | 147 | } | ||
573 | 148 | |||
574 | 149 | gboolean | ||
575 | 150 | remove_emblem_paths(GHashTable* emblem_paths_response) | ||
576 | 151 | { | ||
577 | 152 | /* Only run this on the main loop or you'll cause problems. */ | ||
578 | 153 | if (!emblem_paths_response) | ||
579 | 154 | return FALSE; | ||
580 | 155 | |||
581 | 156 | gchar **emblem_paths_list = g_hash_table_lookup(emblem_paths_response, "path"); | ||
582 | 157 | if (!emblem_paths_list) | ||
583 | 158 | goto exit; | ||
584 | 159 | |||
585 | 160 | // We need to remove the old paths. | ||
586 | 161 | GtkIconTheme * icon_theme = gtk_icon_theme_get_default(); | ||
587 | 162 | gchar ** paths; | ||
588 | 163 | gint path_count; | ||
589 | 164 | |||
590 | 165 | gtk_icon_theme_get_search_path(icon_theme, &paths, &path_count); | ||
591 | 166 | |||
592 | 167 | gint i, j, out = 0; | ||
593 | 168 | gboolean found = FALSE; | ||
594 | 169 | for (i = 0; i < path_count; i++) { | ||
595 | 170 | gboolean keep = TRUE; | ||
596 | 171 | for (j = 0; emblem_paths_list[j] != NULL; j++) { | ||
597 | 172 | if (emblem_paths_list[j][0]) { | ||
598 | 173 | if (!g_strcmp0(paths[i], emblem_paths_list[j])) { | ||
599 | 174 | found = TRUE; | ||
600 | 175 | keep = FALSE; | ||
601 | 176 | g_free(paths[i]); | ||
602 | 177 | break; | ||
603 | 178 | } | ||
604 | 179 | } | ||
605 | 180 | } | ||
606 | 181 | if (keep) { | ||
607 | 182 | paths[out] = paths[i]; | ||
608 | 183 | out++; | ||
609 | 184 | } | ||
610 | 185 | } | ||
611 | 186 | |||
612 | 187 | /* If we found one we need to reset the path to | ||
613 | 188 | accomodate the changes */ | ||
614 | 189 | if (found) { | ||
615 | 190 | paths[out] = NULL; /* Clear the last one */ | ||
616 | 191 | gtk_icon_theme_set_search_path(icon_theme, (const gchar **)paths, out); | ||
617 | 192 | } | ||
618 | 193 | |||
619 | 194 | g_strfreev(paths); | ||
620 | 195 | exit: | ||
621 | 196 | g_hash_table_unref(emblem_paths_response); | ||
622 | 197 | return FALSE; | ||
623 | 198 | } | ||
624 | 199 | |||
625 | 200 | void get_emblem_paths_cb(GHashTable *emblem_paths_response, MarlinDropbox *cvs) | ||
626 | 201 | { | ||
627 | 202 | if (!emblem_paths_response) { | ||
628 | 203 | emblem_paths_response = g_hash_table_new((GHashFunc) g_str_hash, | ||
629 | 204 | (GEqualFunc) g_str_equal); | ||
630 | 205 | //FIXME | ||
631 | 206 | //g_hash_table_insert(emblem_paths_response, "path", DEFAULT_EMBLEM_PATHS); | ||
632 | 207 | } else { | ||
633 | 208 | /* Increase the ref so that finish_general_command doesn't delete it. */ | ||
634 | 209 | g_hash_table_ref(emblem_paths_response); | ||
635 | 210 | } | ||
636 | 211 | |||
637 | 212 | g_mutex_lock(cvs->emblem_paths_mutex); | ||
638 | 213 | if (cvs->emblem_paths) { | ||
639 | 214 | g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); | ||
640 | 215 | cvs->emblem_paths = NULL; | ||
641 | 216 | } | ||
642 | 217 | cvs->emblem_paths = emblem_paths_response; | ||
643 | 218 | g_mutex_unlock(cvs->emblem_paths_mutex); | ||
644 | 219 | |||
645 | 220 | g_idle_add((GSourceFunc) add_emblem_paths, g_hash_table_ref(emblem_paths_response)); | ||
646 | 221 | g_idle_add((GSourceFunc) reset_all_files, cvs); | ||
647 | 222 | } | ||
648 | 223 | #endif | ||
649 | 224 | |||
650 | 225 | static void | ||
651 | 226 | on_connect(MarlinDropbox *cvs) { | ||
652 | 227 | reset_all_files(cvs); | ||
653 | 228 | |||
654 | 229 | g_message ("%s", G_STRFUNC); | ||
655 | 230 | //amtest | ||
656 | 231 | /* We don't necessarly need the original dropbox icons */ | ||
657 | 232 | /*dropbox_command_client_send_command(&(cvs->dc.dcc), | ||
658 | 233 | (MarlinDropboxCommandResponseHandler) get_emblem_paths_cb, | ||
659 | 234 | cvs, "get_emblem_paths", NULL);*/ | ||
660 | 235 | } | ||
661 | 236 | |||
662 | 237 | static void | ||
663 | 238 | on_disconnect(MarlinDropbox *cvs) { | ||
664 | 239 | reset_all_files(cvs); | ||
665 | 240 | |||
666 | 241 | //FIXME | ||
667 | 242 | g_message ("%s", G_STRFUNC); | ||
668 | 243 | //amtest | ||
669 | 244 | #if 0 | ||
670 | 245 | g_mutex_lock(cvs->emblem_paths_mutex); | ||
671 | 246 | /* This call will free the data too. */ | ||
672 | 247 | g_idle_add((GSourceFunc) remove_emblem_paths, cvs->emblem_paths); | ||
673 | 248 | cvs->emblem_paths = NULL; | ||
674 | 249 | g_mutex_unlock(cvs->emblem_paths_mutex); | ||
675 | 250 | #endif | ||
676 | 251 | } | ||
677 | 252 | |||
678 | 253 | static void | ||
679 | 254 | handle_shell_touch(GHashTable *args, MarlinDropbox *cvs) { | ||
693 | 255 | gchar **path; | 143 | gchar **path; |
694 | 256 | 144 | ||
695 | 257 | // debug_enter(); | ||
696 | 258 | |||
697 | 259 | if ((path = g_hash_table_lookup(args, "path")) != NULL && | 145 | if ((path = g_hash_table_lookup(args, "path")) != NULL && |
698 | 260 | path[0][0] == '/') { | 146 | path[0][0] == '/') { |
699 | 261 | GOFFile *file; | 147 | GOFFile *file; |
700 | @@ -292,13 +178,9 @@ | |||
701 | 292 | } | 178 | } |
702 | 293 | 179 | ||
703 | 294 | gboolean | 180 | gboolean |
706 | 295 | marlin_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *dficr) { | 181 | pf_dropbox_finish_file_info_command(DropboxFileInfoCommandResponse *dficr) { |
705 | 296 | |||
707 | 297 | char *str_emblem; | 182 | char *str_emblem; |
708 | 298 | 183 | ||
709 | 299 | //debug_enter(); | ||
710 | 300 | //NautilusOperationResult result = NAUTILUS_OPERATION_FAILED; | ||
711 | 301 | |||
712 | 302 | if (!dficr->dfic->cancelled) { | 184 | if (!dficr->dfic->cancelled) { |
713 | 303 | gchar **status = NULL; | 185 | gchar **status = NULL; |
714 | 304 | gboolean isdir; | 186 | gboolean isdir; |
715 | @@ -311,10 +193,9 @@ | |||
716 | 311 | int i; | 193 | int i; |
717 | 312 | for ( i = 0; status[i] != NULL; i++) { | 194 | for ( i = 0; status[i] != NULL; i++) { |
718 | 313 | if (status[i][0]) { | 195 | if (status[i][0]) { |
721 | 314 | //g_message ("emblem %s", status[i]); | 196 | if ((str_emblem = translate_emblem (status[i])) != NULL) { |
720 | 315 | if ((str_emblem = translate_emblem (status[i])) != NULL) | ||
722 | 316 | gof_file_add_emblem(dficr->dfic->file, str_emblem); | 197 | gof_file_add_emblem(dficr->dfic->file, str_emblem); |
724 | 317 | else | 198 | } else |
725 | 318 | g_warning ("emblem %s not found - %s", status[i], dficr->dfic->file->uri); | 199 | g_warning ("emblem %s not found - %s", status[i], dficr->dfic->file->uri); |
726 | 319 | } | 200 | } |
727 | 320 | } | 201 | } |
728 | @@ -333,16 +214,16 @@ | |||
729 | 333 | if (isdir && | 214 | if (isdir && |
730 | 334 | (tag = g_hash_table_lookup(dficr->folder_tag_response, "tag")) != NULL) { | 215 | (tag = g_hash_table_lookup(dficr->folder_tag_response, "tag")) != NULL) { |
731 | 335 | if (strcmp("public", tag[0]) == 0) { | 216 | if (strcmp("public", tag[0]) == 0) { |
733 | 336 | gof_file_add_emblem(dficr->dfic->file, "emblem-web"); | 217 | gof_file_add_emblem(dficr->dfic->file, emblems[5]); |
734 | 337 | } | 218 | } |
735 | 338 | else if (strcmp("shared", tag[0]) == 0) { | 219 | else if (strcmp("shared", tag[0]) == 0) { |
737 | 339 | gof_file_add_emblem(dficr->dfic->file, "emblem-people"); | 220 | gof_file_add_emblem(dficr->dfic->file, emblems[6]); |
738 | 340 | } | 221 | } |
739 | 341 | else if (strcmp("photos", tag[0]) == 0) { | 222 | else if (strcmp("photos", tag[0]) == 0) { |
741 | 342 | gof_file_add_emblem(dficr->dfic->file, "emblem-photos"); | 223 | gof_file_add_emblem(dficr->dfic->file, emblems[7]); |
742 | 343 | } | 224 | } |
743 | 344 | else if (strcmp("sandbox", tag[0]) == 0) { | 225 | else if (strcmp("sandbox", tag[0]) == 0) { |
745 | 345 | gof_file_add_emblem(dficr->dfic->file, "emblem-star"); | 226 | gof_file_add_emblem(dficr->dfic->file, emblems[8]); |
746 | 346 | } | 227 | } |
747 | 347 | } | 228 | } |
748 | 348 | 229 | ||
749 | @@ -358,29 +239,19 @@ | |||
750 | 358 | else if (strcmp("unsyncable", status[0]) == 0) { | 239 | else if (strcmp("unsyncable", status[0]) == 0) { |
751 | 359 | emblem_code = 3; | 240 | emblem_code = 3; |
752 | 360 | } | 241 | } |
753 | 242 | else if (strcmp("selsync", status[0]) == 0) { | ||
754 | 243 | emblem_code = 4; | ||
755 | 244 | } | ||
756 | 245 | else if (strcmp("app", status[0]) == 0) { | ||
757 | 246 | emblem_code = 5; | ||
758 | 247 | } | ||
759 | 361 | 248 | ||
760 | 362 | if (emblem_code > 0) { | 249 | if (emblem_code > 0) { |
761 | 363 | /* | ||
762 | 364 | debug("%s to %s", emblems[emblem_code-1], | ||
763 | 365 | g_filename_from_uri(dficr->dfic->file->uri, | ||
764 | 366 | NULL, NULL)); | ||
765 | 367 | */ | ||
766 | 368 | //FIXME | ||
767 | 369 | g_message ("emblem code %d", emblem_code); | ||
768 | 370 | gof_file_add_emblem(dficr->dfic->file, emblems[emblem_code-1]); | 250 | gof_file_add_emblem(dficr->dfic->file, emblems[emblem_code-1]); |
769 | 371 | } | 251 | } |
770 | 372 | } | 252 | } |
771 | 373 | } | 253 | } |
772 | 374 | 254 | ||
773 | 375 | /* complete the info request */ | ||
774 | 376 | //FIXME | ||
775 | 377 | /*if (!dropbox_use_operation_in_progress_workaround) { | ||
776 | 378 | nautilus_info_provider_update_complete_invoke(dficr->dfic->update_complete, | ||
777 | 379 | dficr->dfic->provider, | ||
778 | 380 | (NautilusOperationHandle*) dficr->dfic, | ||
779 | 381 | result); | ||
780 | 382 | }*/ | ||
781 | 383 | |||
782 | 384 | /* destroy the objects we created */ | 255 | /* destroy the objects we created */ |
783 | 385 | if (dficr->file_status_response != NULL) | 256 | if (dficr->file_status_response != NULL) |
784 | 386 | g_hash_table_unref(dficr->file_status_response); | 257 | g_hash_table_unref(dficr->file_status_response); |
785 | @@ -390,8 +261,6 @@ | |||
786 | 390 | g_hash_table_unref(dficr->emblems_response); | 261 | g_hash_table_unref(dficr->emblems_response); |
787 | 391 | 262 | ||
788 | 392 | /* unref the objects we didn't create */ | 263 | /* unref the objects we didn't create */ |
789 | 393 | //FIXME | ||
790 | 394 | //g_closure_unref(dficr->dfic->update_complete); | ||
791 | 395 | g_object_unref(dficr->dfic->file); | 264 | g_object_unref(dficr->dfic->file); |
792 | 396 | 265 | ||
793 | 397 | /* now free the structs */ | 266 | /* now free the structs */ |
794 | @@ -402,22 +271,15 @@ | |||
795 | 402 | } | 271 | } |
796 | 403 | 272 | ||
797 | 404 | static void | 273 | static void |
799 | 405 | marlin_dropbox_real_directory_loaded (MarlinPluginsBase *base, void *user_data) | 274 | pf_dropbox_real_directory_loaded (MarlinPluginsBase *base, void *user_data) |
800 | 406 | { | 275 | { |
801 | 407 | /*GOFFile *file; | ||
802 | 408 | |||
803 | 409 | GObject *obj = ((GObject**) user_data)[2]; | ||
804 | 410 | file = g_object_ref ((GOFFile *) obj); | ||
805 | 411 | g_message ("%s : %s", G_STRFUNC, file->uri);*/ | ||
806 | 412 | |||
807 | 413 | //unref file | ||
808 | 414 | 276 | ||
809 | 415 | } | 277 | } |
810 | 416 | 278 | ||
811 | 417 | static void | 279 | static void |
813 | 418 | marlin_dropbox_update_file_info (MarlinPluginsBase *base, GOFFile *file) | 280 | pf_dropbox_update_file_info (MarlinPluginsBase *base, GOFFile *file) |
814 | 419 | { | 281 | { |
816 | 420 | MarlinDropbox *cvs = MARLIN_DROPBOX (base); | 282 | PFDropbox *cvs = PF_DROPBOX (base); |
817 | 421 | 283 | ||
818 | 422 | gchar *path = NULL; | 284 | gchar *path = NULL; |
819 | 423 | 285 | ||
820 | @@ -443,13 +305,7 @@ | |||
821 | 443 | g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); | 305 | g_object_weak_unref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); |
822 | 444 | g_hash_table_remove(cvs->obj2filename, file); | 306 | g_hash_table_remove(cvs->obj2filename, file); |
823 | 445 | g_hash_table_remove(cvs->filename2obj, stored_filename); | 307 | g_hash_table_remove(cvs->filename2obj, stored_filename); |
824 | 446 | //g_signal_handlers_disconnect_by_func(file, G_CALLBACK(changed_cb), cvs); | ||
825 | 447 | } | 308 | } |
826 | 448 | //FIXME check | ||
827 | 449 | /*else if (stored_filename == NULL) { | ||
828 | 450 | g_critical ("grrrrrrrrr"); | ||
829 | 451 | }*/ | ||
830 | 452 | //#if 0 | ||
831 | 453 | else if (stored_filename == NULL) { | 309 | else if (stored_filename == NULL) { |
832 | 454 | GOFFile *f2; | 310 | GOFFile *f2; |
833 | 455 | 311 | ||
834 | @@ -463,15 +319,12 @@ | |||
835 | 463 | just remove the association to the older file object, it's obsolete | 319 | just remove the association to the older file object, it's obsolete |
836 | 464 | */ | 320 | */ |
837 | 465 | g_object_weak_unref(G_OBJECT(f2), (GWeakNotify) when_file_dies, cvs); | 321 | g_object_weak_unref(G_OBJECT(f2), (GWeakNotify) when_file_dies, cvs); |
839 | 466 | //g_signal_handlers_disconnect_by_func(f2, G_CALLBACK(changed_cb), cvs); | 322 | |
840 | 467 | g_hash_table_remove(cvs->filename2obj, filename); | 323 | g_hash_table_remove(cvs->filename2obj, filename); |
841 | 468 | g_hash_table_remove(cvs->obj2filename, f2); | 324 | g_hash_table_remove(cvs->obj2filename, f2); |
842 | 469 | } | 325 | } |
843 | 470 | } | 326 | } |
844 | 471 | //#endif | ||
845 | 472 | 327 | ||
846 | 473 | /* too chatty */ | ||
847 | 474 | /* debug("adding %s <-> 0x%p", filename, file);*/ | ||
848 | 475 | g_object_weak_ref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); | 328 | g_object_weak_ref(G_OBJECT(file), (GWeakNotify) when_file_dies, cvs); |
849 | 476 | g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); | 329 | g_hash_table_insert(cvs->filename2obj, g_strdup(filename), file); |
850 | 477 | g_hash_table_insert(cvs->obj2filename, file, g_strdup(filename)); | 330 | g_hash_table_insert(cvs->obj2filename, file, g_strdup(filename)); |
851 | @@ -488,25 +341,16 @@ | |||
852 | 488 | dfic->cancelled = FALSE; | 341 | dfic->cancelled = FALSE; |
853 | 489 | dfic->provider = base; | 342 | dfic->provider = base; |
854 | 490 | dfic->dc.request_type = GET_FILE_INFO; | 343 | dfic->dc.request_type = GET_FILE_INFO; |
855 | 491 | //FIXME | ||
856 | 492 | //dfic->update_complete = g_closure_ref(update_complete); | ||
857 | 493 | dfic->update_complete = NULL; | 344 | dfic->update_complete = NULL; |
858 | 494 | dfic->file = g_object_ref(file); | 345 | dfic->file = g_object_ref(file); |
859 | 495 | 346 | ||
860 | 496 | dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dfic); | 347 | dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dfic); |
861 | 497 | 348 | ||
862 | 498 | //FIXME | ||
863 | 499 | //*handle = (NautilusOperationHandle *) dfic; | ||
864 | 500 | |||
865 | 501 | /*return dropbox_use_operation_in_progress_workaround | ||
866 | 502 | ? NAUTILUS_OPERATION_COMPLETE | ||
867 | 503 | : NAUTILUS_OPERATION_IN_PROGRESS;*/ | ||
868 | 504 | |||
869 | 505 | g_free (path); | 349 | g_free (path); |
870 | 506 | } | 350 | } |
871 | 507 | 351 | ||
872 | 508 | static char from_hex(gchar ch) { | 352 | static char from_hex(gchar ch) { |
874 | 509 | return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10; | 353 | return g_ascii_isdigit(ch) ? ch - '0' : g_ascii_tolower(ch) - 'a' + 10; |
875 | 510 | } | 354 | } |
876 | 511 | 355 | ||
877 | 512 | // decode in --> out, but dont fill more than n chars into out | 356 | // decode in --> out, but dont fill more than n chars into out |
878 | @@ -536,7 +380,7 @@ | |||
879 | 536 | static void | 380 | static void |
880 | 537 | menu_item_cb(GtkWidget *item, MenuCallbackData *cb_data) | 381 | menu_item_cb(GtkWidget *item, MenuCallbackData *cb_data) |
881 | 538 | { | 382 | { |
883 | 539 | MarlinDropbox *cvs = cb_data->cvs; | 383 | PFDropbox *cvs = cb_data->cvs; |
884 | 540 | DropboxGeneralCommand *dcac; | 384 | DropboxGeneralCommand *dcac; |
885 | 541 | 385 | ||
886 | 542 | dcac = g_new(DropboxGeneralCommand, 1); | 386 | dcac = g_new(DropboxGeneralCommand, 1); |
887 | @@ -567,12 +411,12 @@ | |||
888 | 567 | } | 411 | } |
889 | 568 | 412 | ||
890 | 569 | static void | 413 | static void |
892 | 570 | marlin_dropbox_parse_menu(gchar **options, | 414 | pf_dropbox_parse_menu(gchar **options, |
893 | 571 | GtkWidget *menu, | 415 | GtkWidget *menu, |
894 | 572 | MarlinPluginsBase *base, | 416 | MarlinPluginsBase *base, |
895 | 573 | GOFFile *file) | 417 | GOFFile *file) |
896 | 574 | { | 418 | { |
898 | 575 | MarlinDropbox *cvs = MARLIN_DROPBOX (base); | 419 | PFDropbox *cvs = PF_DROPBOX (base); |
899 | 576 | MenuCallbackData *cb_data; | 420 | MenuCallbackData *cb_data; |
900 | 577 | int i; | 421 | int i; |
901 | 578 | 422 | ||
902 | @@ -593,9 +437,9 @@ | |||
903 | 593 | GhettoURLDecode(verb, verb, strlen(verb)); | 437 | GhettoURLDecode(verb, verb, strlen(verb)); |
904 | 594 | GhettoURLDecode(item_inner, item_inner, strlen(item_inner)); | 438 | GhettoURLDecode(item_inner, item_inner, strlen(item_inner)); |
905 | 595 | 439 | ||
909 | 596 | g_message ("menu %s", item_name); | 440 | g_debug ("menu %s", item_name); |
910 | 597 | g_message ("verb %s", verb); | 441 | g_debug ("verb %s", verb); |
911 | 598 | g_message ("item_inner %s", item_inner); | 442 | g_debug ("item_inner %s", item_inner); |
912 | 599 | 443 | ||
913 | 600 | cb_data = g_new0 (MenuCallbackData, 1); | 444 | cb_data = g_new0 (MenuCallbackData, 1); |
914 | 601 | cb_data->cvs = cvs; | 445 | cb_data->cvs = cvs; |
915 | @@ -664,16 +508,13 @@ | |||
916 | 664 | } | 508 | } |
917 | 665 | 509 | ||
918 | 666 | static void | 510 | static void |
920 | 667 | marlin_dropbox_context_menu (MarlinPluginsBase *base, GtkWidget *menu, GList *files) | 511 | pf_dropbox_context_menu (MarlinPluginsBase *base, GtkWidget *menu, GList *files) |
921 | 668 | { | 512 | { |
923 | 669 | MarlinDropbox *cvs = MARLIN_DROPBOX (base); | 513 | PFDropbox *cvs = PF_DROPBOX (base); |
924 | 670 | GOFFile *file; | 514 | GOFFile *file; |
925 | 671 | gchar *filename_un, *filename; | 515 | gchar *filename_un, *filename; |
926 | 672 | int file_count; | 516 | int file_count; |
927 | 673 | 517 | ||
928 | 674 | g_message ("%s", G_STRFUNC); | ||
929 | 675 | //context_menu_new (u1, menu); | ||
930 | 676 | |||
931 | 677 | cvs->selection = files; | 518 | cvs->selection = files; |
932 | 678 | if ((file_count = g_list_length (cvs->selection)) != 1) | 519 | if ((file_count = g_list_length (cvs->selection)) != 1) |
933 | 679 | return; | 520 | return; |
934 | @@ -715,17 +556,17 @@ | |||
935 | 715 | */ | 556 | */ |
936 | 716 | dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dgc); | 557 | dropbox_command_client_request(&(cvs->dc.dcc), (DropboxCommand *) dgc); |
937 | 717 | 558 | ||
939 | 718 | GTimeVal gtv; | 559 | guint64 gtv; |
940 | 719 | 560 | ||
941 | 720 | /* | 561 | /* |
942 | 721 | * 4. We have to block until it's done because nautilus expects a reply. But we will | 562 | * 4. We have to block until it's done because nautilus expects a reply. But we will |
943 | 722 | * only block for 50 ms for a reply. | 563 | * only block for 50 ms for a reply. |
944 | 723 | */ | 564 | */ |
945 | 724 | 565 | ||
948 | 725 | g_get_current_time(>v); | 566 | gtv = g_get_real_time(); |
949 | 726 | g_time_val_add(>v, 50000); | 567 | gtv = gtv + 5000; |
950 | 727 | 568 | ||
952 | 728 | GHashTable *context_options_response = g_async_queue_timed_pop(reply_queue, >v); | 569 | GHashTable *context_options_response = g_async_queue_timeout_pop(reply_queue, gtv); |
953 | 729 | g_async_queue_unref(reply_queue); | 570 | g_async_queue_unref(reply_queue); |
954 | 730 | 571 | ||
955 | 731 | if (!context_options_response) | 572 | if (!context_options_response) |
956 | @@ -739,16 +580,21 @@ | |||
957 | 739 | GList *toret = NULL; | 580 | GList *toret = NULL; |
958 | 740 | 581 | ||
959 | 741 | if (options && *options && **options) { | 582 | if (options && *options && **options) { |
961 | 742 | GtkWidget *submenu, *root_item; | 583 | GtkWidget *submenu, *root_item, *separator; |
962 | 743 | 584 | ||
964 | 744 | root_item = gtk_menu_item_new_with_mnemonic (_("Dropbo_x")); | 585 | root_item = gtk_menu_item_new_with_label (_("Dropbox")); |
965 | 745 | submenu = gtk_menu_new (); | 586 | submenu = gtk_menu_new (); |
966 | 746 | gtk_widget_show (root_item); | 587 | gtk_widget_show (root_item); |
967 | 747 | gtk_menu_item_set_submenu ((GtkMenuItem *) root_item,submenu); | 588 | gtk_menu_item_set_submenu ((GtkMenuItem *) root_item,submenu); |
968 | 589 | |||
969 | 590 | separator = gtk_separator_menu_item_new (); | ||
970 | 591 | gtk_widget_show (separator); | ||
971 | 592 | gtk_menu_shell_append ((GtkMenuShell*) menu, separator); | ||
972 | 593 | |||
973 | 748 | gtk_menu_shell_append ((GtkMenuShell*) menu, root_item); | 594 | gtk_menu_shell_append ((GtkMenuShell*) menu, root_item); |
974 | 749 | plugins->menus = g_list_prepend (plugins->menus, _g_object_ref0 (root_item)); | 595 | plugins->menus = g_list_prepend (plugins->menus, _g_object_ref0 (root_item)); |
975 | 750 | 596 | ||
977 | 751 | marlin_dropbox_parse_menu(options, submenu, base, file); | 597 | pf_dropbox_parse_menu(options, submenu, base, file); |
978 | 752 | } | 598 | } |
979 | 753 | 599 | ||
980 | 754 | g_hash_table_unref(context_options_response); | 600 | g_hash_table_unref(context_options_response); |
981 | @@ -758,22 +604,18 @@ | |||
982 | 758 | } | 604 | } |
983 | 759 | 605 | ||
984 | 760 | static void | 606 | static void |
986 | 761 | marlin_dropbox_class_init (MarlinDropboxClass *klass) { | 607 | pf_dropbox_class_init (PFDropboxClass *klass) { |
987 | 762 | MarlinPluginsBaseClass *object_class = MARLIN_PLUGINS_BASE_CLASS (klass); | 608 | MarlinPluginsBaseClass *object_class = MARLIN_PLUGINS_BASE_CLASS (klass); |
988 | 763 | //g_type_class_add_private (klass, sizeof (MarlinDropboxPrivate)); | ||
989 | 764 | 609 | ||
994 | 765 | object_class->finalize = marlin_dropbox_finalize; | 610 | object_class->finalize = pf_dropbox_finalize; |
995 | 766 | object_class->directory_loaded = marlin_dropbox_real_directory_loaded; | 611 | object_class->directory_loaded = pf_dropbox_real_directory_loaded; |
996 | 767 | object_class->update_file_info = marlin_dropbox_update_file_info; | 612 | object_class->update_file_info = pf_dropbox_update_file_info; |
997 | 768 | object_class->context_menu = marlin_dropbox_context_menu; | 613 | object_class->context_menu = pf_dropbox_context_menu; |
998 | 769 | } | 614 | } |
999 | 770 | 615 | ||
1000 | 771 | 616 | ||
1001 | 772 | static void | 617 | static void |
1006 | 773 | marlin_dropbox_init (MarlinDropbox *cvs) { | 618 | pf_dropbox_init (PFDropbox *cvs) { |
1003 | 774 | //self->priv = MARLIN_DROPBOX_GET_PRIVATE (self); | ||
1004 | 775 | //self->priv = g_new0 (MarlinDropboxPrivate, 1); | ||
1005 | 776 | |||
1007 | 777 | cvs->filename2obj = g_hash_table_new_full((GHashFunc) g_str_hash, | 619 | cvs->filename2obj = g_hash_table_new_full((GHashFunc) g_str_hash, |
1008 | 778 | (GEqualFunc) g_str_equal, | 620 | (GEqualFunc) g_str_equal, |
1009 | 779 | (GDestroyNotify) g_free, | 621 | (GDestroyNotify) g_free, |
1010 | @@ -782,16 +624,13 @@ | |||
1011 | 782 | (GEqualFunc) g_direct_equal, | 624 | (GEqualFunc) g_direct_equal, |
1012 | 783 | (GDestroyNotify) NULL, | 625 | (GDestroyNotify) NULL, |
1013 | 784 | (GDestroyNotify) g_free); | 626 | (GDestroyNotify) g_free); |
1014 | 785 | //amtest | ||
1015 | 786 | /*cvs->emblem_paths_mutex = g_mutex_new(); | ||
1016 | 787 | cvs->emblem_paths = NULL;*/ | ||
1017 | 788 | 627 | ||
1018 | 789 | /* setup the connection obj*/ | 628 | /* setup the connection obj*/ |
1019 | 790 | dropbox_client_setup(&(cvs->dc)); | 629 | dropbox_client_setup(&(cvs->dc)); |
1020 | 791 | 630 | ||
1021 | 792 | /* our hooks */ | 631 | /* our hooks */ |
1022 | 793 | /* tricky name: shell_touch signal is used for real time events too (like transfert done event) */ | 632 | /* tricky name: shell_touch signal is used for real time events too (like transfert done event) */ |
1024 | 794 | marlin_dropbox_hooks_add(&(cvs->dc.hookserv), "shell_touch", | 633 | pf_dropbox_hooks_add(&(cvs->dc.hookserv), "shell_touch", |
1025 | 795 | (DropboxUpdateHook) handle_shell_touch, cvs); | 634 | (DropboxUpdateHook) handle_shell_touch, cvs); |
1026 | 796 | 635 | ||
1027 | 797 | /* add connection handlers */ | 636 | /* add connection handlers */ |
1028 | @@ -809,25 +648,25 @@ | |||
1029 | 809 | 648 | ||
1030 | 810 | 649 | ||
1031 | 811 | static void | 650 | static void |
1034 | 812 | marlin_dropbox_finalize (MarlinPluginsBase* obj) { | 651 | pf_dropbox_finalize (MarlinPluginsBase* obj) { |
1035 | 813 | MarlinDropbox * self = MARLIN_DROPBOX (obj); | 652 | PFDropbox * self = PF_DROPBOX (obj); |
1036 | 814 | 653 | ||
1039 | 815 | //_g_object_unref0 (self->priv->trash_monitor); | 654 | MARLIN_PLUGINS_BASE_CLASS (pf_dropbox_parent_class)->finalize (obj); |
1038 | 816 | MARLIN_PLUGINS_BASE_CLASS (marlin_dropbox_parent_class)->finalize (obj); | ||
1040 | 817 | } | 655 | } |
1041 | 818 | 656 | ||
1044 | 819 | MarlinDropbox* marlin_dropbox_new () { | 657 | PFDropbox* pf_dropbox_new () { |
1045 | 820 | MarlinDropbox *u1; | 658 | PFDropbox *u1; |
1046 | 821 | 659 | ||
1048 | 822 | u1 = (MarlinDropbox*) marlin_plugins_base_construct (MARLIN_TYPE_DROPBOX); | 660 | u1 = (PFDropbox*) marlin_plugins_base_construct (PF_TYPE_DROPBOX); |
1049 | 823 | 661 | ||
1050 | 824 | return u1; | 662 | return u1; |
1051 | 825 | } | 663 | } |
1052 | 826 | 664 | ||
1053 | 827 | MarlinPluginsBase* module_init() | 665 | MarlinPluginsBase* module_init() |
1054 | 828 | { | 666 | { |
1056 | 829 | MarlinDropbox* u1 = marlin_dropbox_new (); | 667 | PFDropbox* u1 = pf_dropbox_new (); |
1057 | 830 | 668 | ||
1058 | 831 | return MARLIN_PLUGINS_BASE (u1); | 669 | return MARLIN_PLUGINS_BASE (u1); |
1059 | 832 | } | 670 | } |
1060 | 833 | 671 | ||
1061 | 672 | |||
1062 | 834 | 673 | ||
1063 | === modified file 'plugin.h' | |||
1064 | --- plugin.h 2016-06-24 12:59:58 +0000 | |||
1065 | +++ plugin.h 2016-06-24 12:59:58 +0000 | |||
1066 | @@ -1,12 +1,12 @@ | |||
1067 | 1 | /* | 1 | /* |
1068 | 2 | * Copyright (C) 2011 ammonkey <am.monkeyd@gmail.com> | 2 | * Copyright (C) 2011 ammonkey <am.monkeyd@gmail.com> |
1069 | 3 | * | 3 | * |
1071 | 4 | * Marlin is free software: you can redistribute it and/or modify it | 4 | * PantheonFiles is free software: you can redistribute it and/or modify it |
1072 | 5 | * under the terms of the GNU General Public License as published by the | 5 | * under the terms of the GNU General Public License as published by the |
1073 | 6 | * Free Software Foundation, either version 3 of the License, or | 6 | * Free Software Foundation, either version 3 of the License, or |
1074 | 7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
1075 | 8 | * | 8 | * |
1077 | 9 | * Marlin is distributed in the hope that it will be useful, but | 9 | * PantheonFiles is distributed in the hope that it will be useful, but |
1078 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
1079 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
1080 | 12 | * See the GNU General Public License for more details. | 12 | * See the GNU General Public License for more details. |
1081 | @@ -15,51 +15,46 @@ | |||
1082 | 15 | * with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
1083 | 16 | */ | 16 | */ |
1084 | 17 | 17 | ||
1087 | 18 | #ifndef MARLIN_DROPBOX_H | 18 | #ifndef PF_DROPBOX_H |
1088 | 19 | #define MARLIN_DROPBOX_H | 19 | #define PF_DROPBOX_H |
1089 | 20 | 20 | ||
1090 | 21 | #include <glib.h> | 21 | #include <glib.h> |
1091 | 22 | #include <glib-object.h> | 22 | #include <glib-object.h> |
1094 | 23 | #include <marlincore.h> | 23 | #include <pantheon-files-core.h> |
1093 | 24 | //#include <dbus/dbus-glib.h> | ||
1095 | 25 | 24 | ||
1096 | 26 | #include "dropbox-command-client.h" | 25 | #include "dropbox-command-client.h" |
1097 | 27 | #include "dropbox-hooks.h" | 26 | #include "dropbox-hooks.h" |
1098 | 28 | #include "dropbox-client.h" | 27 | #include "dropbox-client.h" |
1099 | 29 | 28 | ||
1106 | 30 | #define MARLIN_TYPE_DROPBOX (marlin_dropbox_get_type ()) | 29 | #define PF_TYPE_DROPBOX (pf_dropbox_get_type ()) |
1107 | 31 | #define MARLIN_DROPBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MARLIN_TYPE_DROPBOX, MarlinDropbox)) | 30 | #define PF_DROPBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PF_TYPE_DROPBOX, PFDropbox)) |
1108 | 32 | #define MARLIN_DROPBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MARLIN_TYPE_DROPBOX, MarlinDropboxClass)) | 31 | #define PF_DROPBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PF_TYPE_DROPBOX, PFDropboxClass)) |
1109 | 33 | #define MARLIN_IS_DROPBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MARLIN_TYPE_DROPBOX)) | 32 | #define PF_IS_DROPBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PF_TYPE_DROPBOX)) |
1110 | 34 | #define MARLIN_IS_DROPBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MARLIN_TYPE_DROPBOX)) | 33 | #define PF_IS_DROPBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PF_TYPE_DROPBOX)) |
1111 | 35 | #define MARLIN_DROPBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MARLIN_TYPE_DROPBOX, MarlinDropboxClass)) | 34 | #define PF_DROPBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PF_TYPE_DROPBOX, PFDropboxClass)) |
1112 | 36 | 35 | ||
1116 | 37 | typedef struct _MarlinDropbox MarlinDropbox; | 36 | typedef struct _PFDropbox PFDropbox; |
1117 | 38 | typedef struct _MarlinDropboxClass MarlinDropboxClass; | 37 | typedef struct _PFDropboxClass PFDropboxClass; |
1118 | 39 | typedef struct _MarlinDropboxPrivate MarlinDropboxPrivate; | 38 | typedef struct _PFDropboxPrivate PFDropboxPrivate; |
1119 | 40 | #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) | 39 | #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) |
1120 | 41 | 40 | ||
1122 | 42 | struct _MarlinDropbox { | 41 | struct _PFDropbox { |
1123 | 43 | MarlinPluginsBase parent_instance; | 42 | MarlinPluginsBase parent_instance; |
1124 | 44 | //MarlinDropboxPrivate * priv; | ||
1125 | 45 | 43 | ||
1126 | 46 | GHashTable *filename2obj; | 44 | GHashTable *filename2obj; |
1127 | 47 | GHashTable *obj2filename; | 45 | GHashTable *obj2filename; |
1128 | 48 | /*GMutex *emblem_paths_mutex; | ||
1129 | 49 | GHashTable *emblem_paths;*/ | ||
1130 | 50 | DropboxClient dc; | 46 | DropboxClient dc; |
1131 | 51 | 47 | ||
1132 | 52 | GList *selection; | 48 | GList *selection; |
1133 | 53 | }; | 49 | }; |
1134 | 54 | 50 | ||
1136 | 55 | struct _MarlinDropboxClass { | 51 | struct _PFDropboxClass { |
1137 | 56 | MarlinPluginsBaseClass parent_class; | 52 | MarlinPluginsBaseClass parent_class; |
1138 | 57 | }; | 53 | }; |
1139 | 58 | 54 | ||
1142 | 59 | struct _MarlinDropboxPrivate { | 55 | struct _PFDropboxPrivate { |
1141 | 60 | /*MarlinTrashMonitor* trash_monitor;*/ | ||
1143 | 61 | }; | 56 | }; |
1144 | 62 | 57 | ||
1146 | 63 | GType marlin_dropbox_get_type (void) G_GNUC_CONST; | 58 | GType pf_dropbox_get_type (void) G_GNUC_CONST; |
1147 | 64 | 59 | ||
1148 | 65 | #endif | 60 | #endif |
There's nothing which strikes me as out-of-place