diff options
author | Saul Wold <Saul.Wold@intel.com> | 2010-11-22 13:57:13 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-11-22 13:57:13 +0000 |
commit | cfe12efb5ec9586dab6961f141d52b103bd8b1d1 (patch) | |
tree | 7108e22aa7ddf6cfc2f1b6c6b73a811187706ecb /meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch | |
parent | 762fd6b7b3b22d7a8cb80ef9e9ba62e7ef21af3e (diff) | |
download | poky-cfe12efb5ec9586dab6961f141d52b103bd8b1d1.tar.gz |
Meta: Recipe Reogranization
This is the next stage of recipe reorganization, in this stage
many recipes where moved to a new meta-demoapps layer since this
is more appropriate for demo usage then the core. Additional some
recipes were moved to meta-extras to indicate they may be depercated
at a future time.
A number of recipes were modified since dependencies need to be
corrected.
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch')
-rw-r--r-- | meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch | 618 |
1 files changed, 0 insertions, 618 deletions
diff --git a/meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch b/meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch deleted file mode 100644 index 67f056b505..0000000000 --- a/meta/recipes-gnome/gnome/gnome-settings-daemon/mount-plugin.patch +++ /dev/null | |||
@@ -1,618 +0,0 @@ | |||
1 | diff --git a/configure.ac b/configure.ac | ||
2 | index 135f2ce..ba737a5 100644 | ||
3 | --- a/configure.ac | ||
4 | +++ b/configure.ac | ||
5 | @@ -356,6 +356,7 @@ plugins/keybindings/Makefile | ||
6 | plugins/keyboard/Makefile | ||
7 | plugins/media-keys/Makefile | ||
8 | plugins/media-keys/cut-n-paste/Makefile | ||
9 | +plugins/mount/Makefile | ||
10 | plugins/mouse/Makefile | ||
11 | plugins/screensaver/Makefile | ||
12 | plugins/sound/Makefile | ||
13 | diff --git a/data/gnome-settings-daemon.schemas.in b/data/gnome-settings-daemon.schemas.in | ||
14 | index 4920ae3..502e9e6 100644 | ||
15 | --- a/data/gnome-settings-daemon.schemas.in | ||
16 | +++ b/data/gnome-settings-daemon.schemas.in | ||
17 | @@ -557,5 +557,29 @@ | ||
18 | </locale> | ||
19 | </schema> | ||
20 | |||
21 | + <schema> | ||
22 | + <key>/schemas/apps/gnome_settings_daemon/plugins/mount/active</key> | ||
23 | + <applyto>/apps/gnome_settings_daemon/plugins/mount/active</applyto> | ||
24 | + <owner>gnome-settings-daemon</owner> | ||
25 | + <type>bool</type> | ||
26 | + <default>TRUE</default> | ||
27 | + <locale name="C"> | ||
28 | + <short>Enable mount plugin</short> | ||
29 | + <long>Set to True to enable the plugin to automount media.</long> | ||
30 | + </locale> | ||
31 | + </schema> | ||
32 | + <schema> | ||
33 | + <key>/schemas/apps/gnome_settings_daemon/plugins/mount/priority</key> | ||
34 | + <applyto>/apps/gnome_settings_daemon/plugins/mount/priority</applyto> | ||
35 | + <owner>gnome-settings-daemon</owner> | ||
36 | + <type>int</type> | ||
37 | + <default>99</default> | ||
38 | + <locale name="C"> | ||
39 | + <short></short> | ||
40 | + <long></long> | ||
41 | + </locale> | ||
42 | + </schema> | ||
43 | + | ||
44 | + | ||
45 | </schemalist> | ||
46 | </gconfschemafile> | ||
47 | diff --git a/plugins/Makefile.am b/plugins/Makefile.am | ||
48 | index 2d33061..46615c1 100644 | ||
49 | --- a/plugins/Makefile.am | ||
50 | +++ b/plugins/Makefile.am | ||
51 | @@ -11,6 +11,7 @@ SUBDIRS = \ | ||
52 | keybindings \ | ||
53 | keyboard \ | ||
54 | media-keys \ | ||
55 | + mount \ | ||
56 | mouse \ | ||
57 | screensaver \ | ||
58 | sound \ | ||
59 | diff --git a/plugins/mount/Makefile.am b/plugins/mount/Makefile.am | ||
60 | new file mode 100644 | ||
61 | index 0000000..188c83d | ||
62 | --- /dev/null | ||
63 | +++ b/plugins/mount/Makefile.am | ||
64 | @@ -0,0 +1,39 @@ | ||
65 | +plugin_LTLIBRARIES = \ | ||
66 | + libmount.la | ||
67 | + | ||
68 | +libmount_la_SOURCES = \ | ||
69 | + gsd-mount-manager.c \ | ||
70 | + gsd-mount-manager.h \ | ||
71 | + gsd-mount-plugin.c \ | ||
72 | + gsd-mount-plugin.h | ||
73 | + | ||
74 | +libmount_la_CPPFLAGS = \ | ||
75 | + -I$(top_srcdir)/gnome-settings-daemon \ | ||
76 | + -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ | ||
77 | + $(AM_CPPFLAGS) | ||
78 | + | ||
79 | +libmount_la_CFLAGS = \ | ||
80 | + $(SETTINGS_PLUGIN_CFLAGS) \ | ||
81 | + $(AM_CFLAGS) | ||
82 | + | ||
83 | +libmount_la_LDFLAGS = \ | ||
84 | + $(GSD_PLUGIN_LDFLAGS) | ||
85 | + | ||
86 | +libmount_la_LIBADD = \ | ||
87 | + $(SETTINGS_PLUGIN_LIBS) | ||
88 | + | ||
89 | +plugin_in_files = \ | ||
90 | + mount.gnome-settings-plugin.in | ||
91 | + | ||
92 | +plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) | ||
93 | + | ||
94 | +EXTRA_DIST = \ | ||
95 | + $(plugin_in_files) | ||
96 | + | ||
97 | +CLEANFILES = \ | ||
98 | + $(plugin_DATA) | ||
99 | + | ||
100 | +DISTCLEANFILES = \ | ||
101 | + $(plugin_DATA) | ||
102 | + | ||
103 | +@GSD_INTLTOOL_PLUGIN_RULE@ | ||
104 | diff --git a/plugins/mount/gsd-mount-manager.c b/plugins/mount/gsd-mount-manager.c | ||
105 | new file mode 100644 | ||
106 | index 0000000..a768f03 | ||
107 | --- /dev/null | ||
108 | +++ b/plugins/mount/gsd-mount-manager.c | ||
109 | @@ -0,0 +1,261 @@ | ||
110 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
111 | + * | ||
112 | + * Copyright (C) 2009 Intel Corporation | ||
113 | + * | ||
114 | + * This program is free software; you can redistribute it and/or modify it under | ||
115 | + * the terms of the GNU General Public License as published by the Free Software | ||
116 | + * Foundation; either version 2 of the License, or (at your option) any later | ||
117 | + * version. | ||
118 | + * | ||
119 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
120 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
121 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
122 | + * details. | ||
123 | + * | ||
124 | + * You should have received a copy of the GNU General Public License along with | ||
125 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
126 | + * Place - Suite 330, Boston, MA 02111-1307, USA. | ||
127 | + * | ||
128 | + */ | ||
129 | + | ||
130 | +#include <config.h> | ||
131 | + | ||
132 | +#include <glib.h> | ||
133 | +#include <glib/gi18n.h> | ||
134 | +#include <gio/gio.h> | ||
135 | +#include <gtk/gtk.h> | ||
136 | + | ||
137 | +#include "gsd-mount-manager.h" | ||
138 | + | ||
139 | +#define GSD_MOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUNT_MANAGER, GsdMountManagerPrivate)) | ||
140 | + | ||
141 | +struct GsdMountManagerPrivate | ||
142 | +{ | ||
143 | + GVolumeMonitor *monitor; | ||
144 | +}; | ||
145 | + | ||
146 | +G_DEFINE_TYPE (GsdMountManager, gsd_mount_manager, G_TYPE_OBJECT) | ||
147 | + | ||
148 | +static gpointer manager_object = NULL; | ||
149 | + | ||
150 | +#if 0 | ||
151 | +static void | ||
152 | +drive_connected_cb (GVolumeMonitor *monitor, | ||
153 | + GDrive *drive, | ||
154 | + GsdMountManager *manager) | ||
155 | +{ | ||
156 | + /* TODO: listen for the eject button */ | ||
157 | +} | ||
158 | +#endif | ||
159 | + | ||
160 | +static void | ||
161 | +volume_mounted_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) | ||
162 | +{ | ||
163 | + GError *error = NULL; | ||
164 | + char *name; | ||
165 | + | ||
166 | + name = g_volume_get_name (G_VOLUME (source_object)); | ||
167 | + | ||
168 | + if (!g_volume_mount_finish (G_VOLUME (source_object), result, &error)) { | ||
169 | + g_debug ("Failed to mount '%s': %s", name, error->message); | ||
170 | + | ||
171 | + if (error->code != G_IO_ERROR_FAILED_HANDLED) { | ||
172 | + char *primary; | ||
173 | + GtkWidget *dialog; | ||
174 | + | ||
175 | + primary = g_strdup_printf (_("Unable to mount %s"), name); | ||
176 | + | ||
177 | + dialog = gtk_message_dialog_new (NULL, 0, | ||
178 | + GTK_MESSAGE_ERROR, | ||
179 | + GTK_BUTTONS_CLOSE, | ||
180 | + primary); | ||
181 | + | ||
182 | + g_free (primary); | ||
183 | + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), error->message); | ||
184 | + | ||
185 | + gtk_dialog_run (GTK_DIALOG (dialog)); | ||
186 | + gtk_widget_destroy (dialog); | ||
187 | + } | ||
188 | + g_error_free (error); | ||
189 | + } else { | ||
190 | + g_debug ("Mounted '%s'", name); | ||
191 | + } | ||
192 | + | ||
193 | + g_free (name); | ||
194 | +} | ||
195 | + | ||
196 | +static void | ||
197 | +volume_added_cb (GVolumeMonitor *monitor, | ||
198 | + GVolume *volume, | ||
199 | + GsdMountManager *manager) | ||
200 | +{ | ||
201 | + char *name; | ||
202 | + | ||
203 | + name = g_volume_get_name (volume); | ||
204 | + g_debug ("Volme '%s' added", name); | ||
205 | + | ||
206 | + if (g_volume_can_mount (volume)) { | ||
207 | + GMountOperation *mount_op; | ||
208 | + | ||
209 | + g_debug ("Mounting '%s'", name); | ||
210 | + | ||
211 | + mount_op = gtk_mount_operation_new (NULL); | ||
212 | + g_volume_mount (volume, G_MOUNT_MOUNT_NONE, | ||
213 | + mount_op, NULL, | ||
214 | + volume_mounted_cb, manager); | ||
215 | + } | ||
216 | + | ||
217 | + g_free (name); | ||
218 | +} | ||
219 | + | ||
220 | +static void | ||
221 | +mount_added_cb (GVolumeMonitor *monitor, | ||
222 | + GMount *mount, | ||
223 | + GsdMountManager *manager) | ||
224 | +{ | ||
225 | + GFile *file; | ||
226 | + char *uri; | ||
227 | + | ||
228 | + file = g_mount_get_root (mount); | ||
229 | + uri = g_file_get_uri (file); | ||
230 | + | ||
231 | + g_debug ("%s mounted, starting file manager", uri); | ||
232 | + | ||
233 | + /* TODO: error */ | ||
234 | + gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL); | ||
235 | + | ||
236 | + g_free (uri); | ||
237 | + g_object_unref (file); | ||
238 | +} | ||
239 | + | ||
240 | +static void | ||
241 | +mount_existing_volumes (GsdMountManager *manager) | ||
242 | +{ | ||
243 | + /* TODO: iterate over drives to hook up eject */ | ||
244 | + GList *l; | ||
245 | + | ||
246 | + g_debug ("Mounting existing volumes"); | ||
247 | + | ||
248 | + l = g_volume_monitor_get_volumes (manager->priv->monitor); | ||
249 | + while (l) { | ||
250 | + GVolume *volume = l->data; | ||
251 | + GMount *mount; | ||
252 | + | ||
253 | + mount = g_volume_get_mount (volume); | ||
254 | + if (mount == NULL && | ||
255 | + g_volume_can_mount (volume) && | ||
256 | + g_volume_should_automount (volume)) { | ||
257 | + GMountOperation *mount_op; | ||
258 | + char *name; | ||
259 | + | ||
260 | + name = g_volume_get_name (volume); | ||
261 | + g_debug ("Mounting '%s'", name); | ||
262 | + g_free (name); | ||
263 | + | ||
264 | + mount_op = gtk_mount_operation_new (NULL); | ||
265 | + g_volume_mount (volume, G_MOUNT_MOUNT_NONE, | ||
266 | + mount_op, NULL, | ||
267 | + volume_mounted_cb, manager); | ||
268 | + } | ||
269 | + | ||
270 | + if (mount) | ||
271 | + g_object_unref (mount); | ||
272 | + g_object_unref (volume); | ||
273 | + l = g_list_delete_link (l, l); | ||
274 | + } | ||
275 | +} | ||
276 | + | ||
277 | +gboolean | ||
278 | +gsd_mount_manager_start (GsdMountManager *manager, | ||
279 | + GError **error) | ||
280 | +{ | ||
281 | + g_debug ("Starting mount manager"); | ||
282 | + | ||
283 | + manager->priv->monitor = g_volume_monitor_get (); | ||
284 | + | ||
285 | +#if 0 | ||
286 | + g_signal_connect_object (manager->priv->monitor, "drive-connected", | ||
287 | + G_CALLBACK (drive_connected_cb), manager, 0); | ||
288 | +#endif | ||
289 | + g_signal_connect_object (manager->priv->monitor, "volume-added", | ||
290 | + G_CALLBACK (volume_added_cb), manager, 0); | ||
291 | + g_signal_connect_object (manager->priv->monitor, "mount-added", | ||
292 | + G_CALLBACK (mount_added_cb), manager, 0); | ||
293 | + | ||
294 | + /* TODO: handle eject buttons */ | ||
295 | + | ||
296 | +#if 0 | ||
297 | + mount_existing_volumes (manager); | ||
298 | +#endif | ||
299 | + | ||
300 | + return TRUE; | ||
301 | +} | ||
302 | + | ||
303 | +void | ||
304 | +gsd_mount_manager_stop (GsdMountManager *manager) | ||
305 | +{ | ||
306 | + g_debug ("Stopping mount manager"); | ||
307 | +} | ||
308 | + | ||
309 | +static void | ||
310 | +gsd_mount_manager_dispose (GObject *object) | ||
311 | +{ | ||
312 | + GsdMountManager *manager = GSD_MOUNT_MANAGER (object); | ||
313 | + | ||
314 | + if (manager->priv->monitor) { | ||
315 | + g_signal_handlers_disconnect_by_func | ||
316 | + (manager->priv->monitor, volume_added_cb, manager); | ||
317 | + g_signal_handlers_disconnect_by_func | ||
318 | + (manager->priv->monitor, mount_added_cb, manager); | ||
319 | + g_object_unref (manager->priv->monitor); | ||
320 | + manager->priv->monitor = NULL; | ||
321 | + } | ||
322 | + | ||
323 | + G_OBJECT_CLASS (gsd_mount_manager_parent_class)->dispose (object); | ||
324 | +} | ||
325 | + | ||
326 | +static void | ||
327 | +gsd_mount_manager_init (GsdMountManager *manager) | ||
328 | +{ | ||
329 | + manager->priv = GSD_MOUNT_MANAGER_GET_PRIVATE (manager); | ||
330 | +} | ||
331 | + | ||
332 | +static void | ||
333 | +gsd_mount_manager_finalize (GObject *object) | ||
334 | +{ | ||
335 | + GsdMountManager *mount_manager; | ||
336 | + | ||
337 | + g_return_if_fail (object != NULL); | ||
338 | + g_return_if_fail (GSD_IS_MOUNT_MANAGER (object)); | ||
339 | + | ||
340 | + mount_manager = GSD_MOUNT_MANAGER (object); | ||
341 | + | ||
342 | + g_return_if_fail (mount_manager->priv != NULL); | ||
343 | + | ||
344 | + G_OBJECT_CLASS (gsd_mount_manager_parent_class)->finalize (object); | ||
345 | +} | ||
346 | + | ||
347 | +static void | ||
348 | +gsd_mount_manager_class_init (GsdMountManagerClass *klass) | ||
349 | +{ | ||
350 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
351 | + | ||
352 | + object_class->dispose = gsd_mount_manager_dispose; | ||
353 | + object_class->finalize = gsd_mount_manager_finalize; | ||
354 | + | ||
355 | + g_type_class_add_private (klass, sizeof (GsdMountManagerPrivate)); | ||
356 | +} | ||
357 | + | ||
358 | +GsdMountManager * | ||
359 | +gsd_mount_manager_new (void) | ||
360 | +{ | ||
361 | + if (manager_object != NULL) { | ||
362 | + g_object_ref (manager_object); | ||
363 | + } else { | ||
364 | + manager_object = g_object_new (GSD_TYPE_MOUNT_MANAGER, NULL); | ||
365 | + g_object_add_weak_pointer (manager_object, | ||
366 | + (gpointer *) &manager_object); | ||
367 | + } | ||
368 | + | ||
369 | + return GSD_MOUNT_MANAGER (manager_object); | ||
370 | +} | ||
371 | diff --git a/plugins/mount/gsd-mount-manager.h b/plugins/mount/gsd-mount-manager.h | ||
372 | new file mode 100644 | ||
373 | index 0000000..9093fff | ||
374 | --- /dev/null | ||
375 | +++ b/plugins/mount/gsd-mount-manager.h | ||
376 | @@ -0,0 +1,58 @@ | ||
377 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
378 | + * | ||
379 | + * Copyright (C) 2009 Intel Corporation | ||
380 | + * | ||
381 | + * This program is free software; you can redistribute it and/or modify it under | ||
382 | + * the terms of the GNU General Public License as published by the Free Software | ||
383 | + * Foundation; either version 2 of the License, or (at your option) any later | ||
384 | + * version. | ||
385 | + * | ||
386 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
387 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
388 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
389 | + * details. | ||
390 | + * | ||
391 | + * You should have received a copy of the GNU General Public License along with | ||
392 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
393 | + * Place - Suite 330, Boston, MA 02111-1307, USA. | ||
394 | + * | ||
395 | + */ | ||
396 | + | ||
397 | +#ifndef __GSD_MOUNT_MANAGER_H | ||
398 | +#define __GSD_MOUNT_MANAGER_H | ||
399 | + | ||
400 | +#include <glib-object.h> | ||
401 | + | ||
402 | +G_BEGIN_DECLS | ||
403 | + | ||
404 | +#define GSD_TYPE_MOUNT_MANAGER (gsd_mount_manager_get_type ()) | ||
405 | +#define GSD_MOUNT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUNT_MANAGER, GsdMountManager)) | ||
406 | +#define GSD_MOUNT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUNT_MANAGER, GsdMountManagerClass)) | ||
407 | +#define GSD_IS_MOUNT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUNT_MANAGER)) | ||
408 | +#define GSD_IS_MOUNT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUNT_MANAGER)) | ||
409 | +#define GSD_MOUNT_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUNT_MANAGER, GsdMountManagerClass)) | ||
410 | + | ||
411 | +typedef struct GsdMountManagerPrivate GsdMountManagerPrivate; | ||
412 | + | ||
413 | +typedef struct | ||
414 | +{ | ||
415 | + GObject parent; | ||
416 | + GsdMountManagerPrivate *priv; | ||
417 | +} GsdMountManager; | ||
418 | + | ||
419 | +typedef struct | ||
420 | +{ | ||
421 | + GObjectClass parent_class; | ||
422 | +} GsdMountManagerClass; | ||
423 | + | ||
424 | +GType gsd_mount_manager_get_type (void); | ||
425 | + | ||
426 | +GsdMountManager * gsd_mount_manager_new (void); | ||
427 | + | ||
428 | +gboolean gsd_mount_manager_start (GsdMountManager *manager, | ||
429 | + GError **error); | ||
430 | +void gsd_mount_manager_stop (GsdMountManager *manager); | ||
431 | + | ||
432 | +G_END_DECLS | ||
433 | + | ||
434 | +#endif /* __GSD_MOUNT_MANAGER_H */ | ||
435 | diff --git a/plugins/mount/gsd-mount-plugin.c b/plugins/mount/gsd-mount-plugin.c | ||
436 | new file mode 100644 | ||
437 | index 0000000..af295a5 | ||
438 | --- /dev/null | ||
439 | +++ b/plugins/mount/gsd-mount-plugin.c | ||
440 | @@ -0,0 +1,103 @@ | ||
441 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
442 | + * | ||
443 | + * Copyright (C) 2009 Intel Corporation | ||
444 | + * | ||
445 | + * This program is free software; you can redistribute it and/or modify it under | ||
446 | + * the terms of the GNU General Public License as published by the Free Software | ||
447 | + * Foundation; either version 2, or (at your option) any later version. | ||
448 | + * | ||
449 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
450 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
451 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
452 | + * details. | ||
453 | + * | ||
454 | + * You should have received a copy of the GNU General Public License along with | ||
455 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
456 | + * Place - Suite 330, Boston, MA 02111-1307, USA. | ||
457 | + * | ||
458 | + */ | ||
459 | + | ||
460 | +#include <config.h> | ||
461 | + | ||
462 | +#include <glib/gi18n.h> | ||
463 | +#include <gmodule.h> | ||
464 | +#include <gnome-settings-daemon/gnome-settings-plugin.h> | ||
465 | + | ||
466 | +#include "gsd-mount-plugin.h" | ||
467 | +#include "gsd-mount-manager.h" | ||
468 | + | ||
469 | +struct GsdMountPluginPrivate { | ||
470 | + GsdMountManager *manager; | ||
471 | +}; | ||
472 | + | ||
473 | +#define GSD_MOUNT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_MOUNT_PLUGIN, GsdMountPluginPrivate)) | ||
474 | + | ||
475 | +GNOME_SETTINGS_PLUGIN_REGISTER (GsdMountPlugin, gsd_mount_plugin) | ||
476 | + | ||
477 | +static void | ||
478 | +gsd_mount_plugin_init (GsdMountPlugin *plugin) | ||
479 | +{ | ||
480 | + plugin->priv = GSD_MOUNT_PLUGIN_GET_PRIVATE (plugin); | ||
481 | + | ||
482 | + g_debug ("GsdMountPlugin initializing"); | ||
483 | + | ||
484 | + plugin->priv->manager = gsd_mount_manager_new (); | ||
485 | +} | ||
486 | + | ||
487 | +static void | ||
488 | +gsd_mount_plugin_finalize (GObject *object) | ||
489 | +{ | ||
490 | + GsdMountPlugin *plugin; | ||
491 | + | ||
492 | + g_return_if_fail (object != NULL); | ||
493 | + g_return_if_fail (GSD_IS_MOUNT_PLUGIN (object)); | ||
494 | + | ||
495 | + g_debug ("GsdMountPlugin finalizing"); | ||
496 | + | ||
497 | + plugin = GSD_MOUNT_PLUGIN (object); | ||
498 | + | ||
499 | + g_return_if_fail (plugin->priv != NULL); | ||
500 | + | ||
501 | + if (plugin->priv->manager != NULL) { | ||
502 | + g_object_unref (plugin->priv->manager); | ||
503 | + } | ||
504 | + | ||
505 | + G_OBJECT_CLASS (gsd_mount_plugin_parent_class)->finalize (object); | ||
506 | +} | ||
507 | + | ||
508 | +static void | ||
509 | +impl_activate (GnomeSettingsPlugin *plugin) | ||
510 | +{ | ||
511 | + gboolean res; | ||
512 | + GError *error; | ||
513 | + | ||
514 | + g_debug ("Activating mount plugin"); | ||
515 | + | ||
516 | + error = NULL; | ||
517 | + res = gsd_mount_manager_start (GSD_MOUNT_PLUGIN (plugin)->priv->manager, &error); | ||
518 | + if (! res) { | ||
519 | + g_warning ("Unable to start mount manager: %s", error->message); | ||
520 | + g_error_free (error); | ||
521 | + } | ||
522 | +} | ||
523 | + | ||
524 | +static void | ||
525 | +impl_deactivate (GnomeSettingsPlugin *plugin) | ||
526 | +{ | ||
527 | + g_debug ("Deactivating mount plugin"); | ||
528 | + gsd_mount_manager_stop (GSD_MOUNT_PLUGIN (plugin)->priv->manager); | ||
529 | +} | ||
530 | + | ||
531 | +static void | ||
532 | +gsd_mount_plugin_class_init (GsdMountPluginClass *klass) | ||
533 | +{ | ||
534 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
535 | + GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass); | ||
536 | + | ||
537 | + object_class->finalize = gsd_mount_plugin_finalize; | ||
538 | + | ||
539 | + plugin_class->activate = impl_activate; | ||
540 | + plugin_class->deactivate = impl_deactivate; | ||
541 | + | ||
542 | + g_type_class_add_private (klass, sizeof (GsdMountPluginPrivate)); | ||
543 | +} | ||
544 | diff --git a/plugins/mount/gsd-mount-plugin.h b/plugins/mount/gsd-mount-plugin.h | ||
545 | new file mode 100644 | ||
546 | index 0000000..526a41f | ||
547 | --- /dev/null | ||
548 | +++ b/plugins/mount/gsd-mount-plugin.h | ||
549 | @@ -0,0 +1,55 @@ | ||
550 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
551 | + * | ||
552 | + * Copyright (C) 2009 Intel Corporation | ||
553 | + * | ||
554 | + * This program is free software; you can redistribute it and/or modify it under | ||
555 | + * the terms of the GNU General Public License as published by the Free Software | ||
556 | + * Foundation; either version 2, or (at your option) any later version. | ||
557 | + * | ||
558 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
559 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
560 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
561 | + * details. | ||
562 | + * | ||
563 | + * You should have received a copy of the GNU General Public License along with | ||
564 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
565 | + * Place - Suite 330, Boston, MA 02111-1307, USA. | ||
566 | + * | ||
567 | + */ | ||
568 | + | ||
569 | +#ifndef __GSD_MOUNT_PLUGIN_H__ | ||
570 | +#define __GSD_MOUNT_PLUGIN_H__ | ||
571 | + | ||
572 | +#include <glib-object.h> | ||
573 | +#include <gmodule.h> | ||
574 | +#include <gnome-settings-daemon/gnome-settings-plugin.h> | ||
575 | + | ||
576 | +G_BEGIN_DECLS | ||
577 | + | ||
578 | +#define GSD_TYPE_MOUNT_PLUGIN (gsd_mount_plugin_get_type ()) | ||
579 | +#define GSD_MOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUNT_PLUGIN, GsdMountPlugin)) | ||
580 | +#define GSD_MOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUNT_PLUGIN, GsdMountPluginClass)) | ||
581 | +#define GSD_IS_MOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUNT_PLUGIN)) | ||
582 | +#define GSD_IS_MOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUNT_PLUGIN)) | ||
583 | +#define GSD_MOUNT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUNT_PLUGIN, GsdMountPluginClass)) | ||
584 | + | ||
585 | +typedef struct GsdMountPluginPrivate GsdMountPluginPrivate; | ||
586 | + | ||
587 | +typedef struct | ||
588 | +{ | ||
589 | + GnomeSettingsPlugin parent; | ||
590 | + GsdMountPluginPrivate *priv; | ||
591 | +} GsdMountPlugin; | ||
592 | + | ||
593 | +typedef struct | ||
594 | +{ | ||
595 | + GnomeSettingsPluginClass parent_class; | ||
596 | +} GsdMountPluginClass; | ||
597 | + | ||
598 | +GType gsd_mount_plugin_get_type (void) G_GNUC_CONST; | ||
599 | + | ||
600 | +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); | ||
601 | + | ||
602 | +G_END_DECLS | ||
603 | + | ||
604 | +#endif /* __GSD_MOUNT_PLUGIN_H__ */ | ||
605 | diff --git a/plugins/mount/mount.gnome-settings-plugin.in b/plugins/mount/mount.gnome-settings-plugin.in | ||
606 | new file mode 100644 | ||
607 | index 0000000..ca29ad1 | ||
608 | --- /dev/null | ||
609 | +++ b/plugins/mount/mount.gnome-settings-plugin.in | ||
610 | @@ -0,0 +1,8 @@ | ||
611 | +[GNOME Settings Plugin] | ||
612 | +Module=mount | ||
613 | +IAge=0 | ||
614 | +_Name=Mount | ||
615 | +_Description=Mount removable media | ||
616 | +Authors=Ross Burton | ||
617 | +Copyright=Copyright © 2009 Intel Corporation | ||
618 | +Website= | ||