~ubuntu-branches/ubuntu/hardy/gxine/hardy

« back to all changes in this revision

Viewing changes to src/desktop_integration.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-03-21 11:24:59 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080321112459-igb0jy01nytpdrzt
Tags: 0.5.901-1ubuntu1
* merge debian changes for hardy PPA. Remaining changes:
  - debian/control: added Xb-Npp-xxx tags accordingly to "firefox distro
    add-on suport" spec,
    (https://blueprints.launchpad.net/ubuntu/+spec/firefox-distro-addon-support)
* Feature Freeze exception granted in LP: #204563
* New upstream release fixes playing DVDs. LP: #128864
* mime.default: add "x-content/video-dvd;x-content/video-vcd;x-content/video-svcd;"
  to get it listed as a player for dvd and video cds in nautilus. Thanks to
  Sebastien Bacher for the hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2002-2005 the xine-project
 
2
 * Copyright (C) 2002-2006 the xine-project
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public License as
16
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
17
17
 * USA
18
18
 *
19
 
 * $Id: desktop_integration.c,v 1.21 2006/03/27 22:11:24 dsalt Exp $
20
 
 *
21
19
 * helper functions to register gxine with kde and gnome
22
20
 * (and possibly cde in the future)
23
21
 *
43
41
#include "desktop_integration.h"
44
42
#include "utils.h"
45
43
 
 
44
#define LIBGNOMEVFS "libgnomevfs-2.so.0"
 
45
#define LIBGNOMEUI  "libgnomeui-2.so.0"
 
46
 
46
47
typedef enum { GNOME_VFS_OK } GnomeVFSResult; /* incomplete */
47
48
 
48
49
/*
56
57
  void (*application_registry_set_value)          (const char *app_id, const char *key, const char *value);
57
58
  void (*application_registry_set_bool_value)     (const char *app_id, const char *key, int value);
58
59
  void (*application_registry_remove_mime_type)   (const char *app_id, const char *mime_type);
59
 
#ifndef GNOME_VFS_DISABLE_DEPRECATED
60
60
  void (*mime_freeze) (void);
61
61
  void (*mime_thaw)   (void);
62
 
#endif
63
62
};
64
63
 
65
64
/*
84
83
#define gnome_vfs_application_registry_set_value gnome_vfs->application_registry_set_value
85
84
#define gnome_vfs_application_registry_set_bool_value gnome_vfs->application_registry_set_bool_value
86
85
 
87
 
#define gnome_vfs_mime_thaw gnome_vfs->mime_thaw
88
 
#define gnome_vfs_mime_freeze gnome_vfs->mime_freeze
 
86
#define gnome_vfs_mime_freeze() do { if (gnome_vfs->mime_freeze) gnome_vfs->mime_freeze (); } while (0)
 
87
#define gnome_vfs_mime_thaw()   do { if (gnome_vfs->mime_thaw)   gnome_vfs->mime_thaw ();   } while (0)
89
88
 
90
89
static void * gnome_vfs_handle = NULL;
91
90
static int gnome_vfs_available = -1;
92
91
static struct gnome_vfs_functions * gnome_vfs = NULL;
93
92
 
 
93
static void * gnome_ui_handle = NULL;
 
94
 
94
95
 
95
96
/*
96
 
 * load the gnome-vfs library and initialize the function pointers
 
97
 * load the GnomeVFS and GnomeUI library
 
98
 * If using the integration wizard, also initialize the function pointers
97
99
 */
98
100
 
99
101
typedef void (*func_t) ();
116
118
                         get_func ("gnome_vfs_" #VAR))) \
117
119
    return gnome_vfs_available = 0
118
120
 
119
 
gboolean di_gnome_vfs_init (void)
 
121
#define GET_FUNC_S_I(VAR) \
 
122
  gnome_vfs->VAR = (typeof (gnome_vfs->VAR)) get_func ("gnome_vfs_" #VAR)
 
123
 
 
124
gboolean gxine_vfs_init (void)
120
125
{
121
 
  void (*gnome_vfs_init_func) (void) = NULL;
122
 
  void (*gnome_vfs_mime_get_value) (const char *, const char *) = NULL;
 
126
  void (*init_func) (void) = NULL;
123
127
 
124
128
  if (gnome_vfs_available != -1)
125
129
    return gnome_vfs_available;
126
130
 
127
131
  /* load the gnomevfs library */
128
 
  gnome_vfs_handle = dlopen ("libgnomevfs-2.so.0", RTLD_LAZY);
 
132
  gnome_vfs_handle = dlopen (LIBGNOMEVFS, RTLD_LAZY);
129
133
  if (!gnome_vfs_handle)
130
134
  {
131
135
    fprintf (stderr, "%s.\n", dlerror());
135
139
  gnome_vfs = (struct gnome_vfs_functions *) calloc (1, sizeof (struct gnome_vfs_functions));
136
140
 
137
141
  /* this call causes gnome-vfs to become initialized */
138
 
  GET_FUNC (gnome_vfs_init_func, "gnome_vfs_init");
139
 
  gnome_vfs_init_func ();
 
142
  GET_FUNC (init_func, "gnome_vfs_init");
 
143
  init_func ();
 
144
 
 
145
  /* load the gnomeui library (for the authentication bits) */
 
146
  gnome_ui_handle = dlopen (LIBGNOMEUI, RTLD_LAZY);
 
147
  if (gnome_ui_handle)
 
148
  {
 
149
    /* this call causes gnome-vfs to become initialized */
 
150
    init_func = dlsym (gnome_ui_handle, "gnome_authentication_manager_init");
 
151
    if (init_func)
 
152
      init_func ();
 
153
    else
 
154
      fprintf (stderr, "%s.\n", dlerror());
 
155
  }
 
156
  else
 
157
    fprintf (stderr, "%s.\n", dlerror());
 
158
 
 
159
#ifdef USE_INTEGRATION_WIZARD
 
160
  void (*gnome_vfs_mime_get_value) (const char *, const char *) = NULL;
140
161
 
141
162
  GET_FUNC (gnome_vfs_mime_get_value, "gnome_vfs_mime_get_value");
142
163
  gnome_vfs_mime_get_value ("text/plain", "description");
143
164
 
144
165
  /* extract needed symbols from the library */
145
 
  GET_FUNC_S (mime_freeze);
146
 
  GET_FUNC_S (mime_thaw);
 
166
  GET_FUNC_S_I (mime_freeze);
 
167
  GET_FUNC_S_I (mime_thaw);
147
168
  GET_FUNC_S (application_registry_remove_application);
148
169
  GET_FUNC_S (application_registry_add_mime_type);
149
170
  GET_FUNC_S (application_registry_set_value);
150
171
  GET_FUNC_S (application_registry_set_bool_value);
151
172
  GET_FUNC_S (application_registry_remove_mime_type);
 
173
#endif
152
174
 
153
175
  return gnome_vfs_available = 1;
154
176
}
162
184
  if ((VAR = (typeof (VAR)) get_func ((NAME))) == NULL) \
163
185
    return
164
186
 
165
 
static void gnome_vfs_shutdown (void)
 
187
static void di_gnome_vfs_flush (void)
166
188
{
167
189
  /* release the gnomevfs library */
168
190
  if (gnome_vfs_handle)
173
195
    GET_FUNC (gnome_vfs_application_registry_sync, "gnome_vfs_application_registry_sync");
174
196
 
175
197
    gnome_vfs_application_registry_sync ();
176
 
    dlclose (gnome_vfs_handle);
 
198
    /* dlclose (gnome_vfs_handle); */
177
199
  }
178
200
 
179
201
  free (gnome_vfs);
270
292
 
271
293
  section = "GNOME";
272
294
 
273
 
  if (!di_gnome_vfs_init())
 
295
  if (!gxine_vfs_init())
274
296
  {
275
297
    di_report (_("GNOME initialisation failed"));
276
298
    return;
309
331
  /* force the user.mime and user.keys to be written  */
310
332
  gnome_vfs_mime_thaw();
311
333
 
312
 
  gnome_vfs_shutdown();
 
334
  di_gnome_vfs_flush();
313
335
}
314
336
 
315
337
void di_register_kde (void)