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