~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/widgets/gimpdbusservice.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * GimpDBusService
 
5
 * Copyright (C) 2007 Sven Neumann <sven@gimp.org>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#if HAVE_DBUS_GLIB
 
25
 
 
26
#include <dbus/dbus-glib.h>
 
27
 
 
28
#include "core/core-types.h"
 
29
 
 
30
#include "core/gimp.h"
 
31
 
 
32
#include "file/file-open.h"
 
33
 
 
34
#include "gimpdbusservice.h"
 
35
#include "gimpdbusservice-glue.h"
 
36
#include "gimpuimanager.c"
 
37
 
 
38
 
 
39
static void  gimp_dbus_service_class_init (GimpDBusServiceClass *klass);
 
40
static void  gimp_dbus_service_init       (GimpDBusService      *service);
 
41
 
 
42
G_DEFINE_TYPE (GimpDBusService, gimp_dbus_service, G_TYPE_OBJECT)
 
43
 
 
44
 
 
45
static void
 
46
gimp_dbus_service_class_init (GimpDBusServiceClass *klass)
 
47
{
 
48
  dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
 
49
                                   &dbus_glib_gimp_object_info);
 
50
}
 
51
 
 
52
static void
 
53
gimp_dbus_service_init (GimpDBusService *service)
 
54
{
 
55
}
 
56
 
 
57
GObject *
 
58
gimp_dbus_service_new (Gimp *gimp)
 
59
{
 
60
  GimpDBusService *service;
 
61
 
 
62
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
63
 
 
64
  service = g_object_new (GIMP_TYPE_DBUS_SERVICE, NULL);
 
65
 
 
66
  service->gimp = gimp;
 
67
 
 
68
  return G_OBJECT (service);
 
69
}
 
70
 
 
71
gboolean
 
72
gimp_dbus_service_open (GimpDBusService  *service,
 
73
                        const gchar      *uri,
 
74
                        gboolean         *success,
 
75
                        GError          **dbus_error)
 
76
{
 
77
  g_return_val_if_fail (GIMP_IS_DBUS_SERVICE (service), FALSE);
 
78
  g_return_val_if_fail (uri != NULL, FALSE);
 
79
  g_return_val_if_fail (success != NULL, FALSE);
 
80
 
 
81
  *success = file_open_from_command_line (service->gimp, uri, FALSE);
 
82
 
 
83
  return TRUE;
 
84
}
 
85
 
 
86
gboolean
 
87
gimp_dbus_service_open_as_new (GimpDBusService  *service,
 
88
                               const gchar      *uri,
 
89
                               gboolean         *success,
 
90
                               GError          **dbus_error)
 
91
{
 
92
  g_return_val_if_fail (GIMP_IS_DBUS_SERVICE (service), FALSE);
 
93
  g_return_val_if_fail (uri != NULL, FALSE);
 
94
  g_return_val_if_fail (success != NULL, FALSE);
 
95
 
 
96
  *success = file_open_from_command_line (service->gimp, uri, TRUE);
 
97
 
 
98
  return TRUE;
 
99
}
 
100
 
 
101
gboolean
 
102
gimp_dbus_service_activate (GimpDBusService  *service,
 
103
                            GError          **dbus_error)
 
104
{
 
105
  const GList *managers;
 
106
 
 
107
  g_return_val_if_fail (GIMP_IS_DBUS_SERVICE (service), FALSE);
 
108
 
 
109
  /* raise the toolbox */
 
110
  managers = gimp_ui_managers_from_name ("<Image>");
 
111
 
 
112
  if (managers)
 
113
    gimp_ui_manager_activate_action (managers->data,
 
114
                                     "dialogs", "dialogs-toolbox");
 
115
 
 
116
  return TRUE;
 
117
}
 
118
 
 
119
#endif /* HAVE_DBUS_GLIB */