Debian Codegraph @

lib/packagekit-glib2/pk-desktop.c

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2008 Richard Hughes <[email protected]>
4 *
5 * Licensed under the GNU Lesser General Public License Version 2.1
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * SECTION:pk-desktop
24 * @short_description: Find desktop metadata about a package
25 *
26 * Desktop metadata such as icon name and localised summary may be stored in
27 * a local sqlite cache, and this module allows applications to query this.
28 */
29
30 #include "config.h"
31
32 #include <glib.h>
33 #include <packagekit-glib2/pk-desktop.h>
34
35 G_DEFINE_TYPE (PkDesktop, pk_desktop, G_TYPE_OBJECT)
36 static gpointer pk_desktop_object = NULL;
37
38 /**
39 * pk_desktop_get_files_for_package:
40 * @desktop: a valid #PkDesktop instance
41 * @package: the package name, e.g. "gnome-power-manager"
42 * @error: a #GError to put the error code and message in, or %NULL
43 *
44 * Return all desktop files owned by a package, regardless if they are shown
45 * in the main menu or not.
46 *
47 * Return value: (transfer container) (element-type utf8): string array of results, free with g_ptr_array_unref()
48 *
49 * NOTE: This method is unused and will be removed next time the library
50 * soname changes!
51 *
52 * Since: 0.5.3
53 **/
54 GPtrArray *
55 pk_desktop_get_files_for_package (PkDesktop *desktop, const gchar *package, GError **error)
56 {
57 g_set_error_literal (error, 1, 0, "no longer supported");
58 return NULL;
59 }
60
61 /**
62 * pk_desktop_get_shown_for_package:
63 * @desktop: a valid #PkDesktop instance
64 * @package: the package name, e.g. "gnome-power-manager"
65 * @error: a #GError to put the error code and message in, or %NULL
66 *
67 * Return all desktop files owned by a package that would be shown in a menu,
68 * i.e are an application
69 *
70 * Return value: (transfer container) (element-type utf8): string array of results, free with g_ptr_array_unref()
71 *
72 * NOTE: This method is unused and will be removed next time the library
73 * soname changes!
74 *
75 * Since: 0.5.3
76 **/
77 GPtrArray *
78 pk_desktop_get_shown_for_package (PkDesktop *desktop, const gchar *package, GError **error)
79 {
80 g_set_error_literal (error, 1, 0, "no longer supported");
81 return NULL;
82 }
83
84 /**
85 * pk_desktop_get_package_for_file:
86 * @desktop: a valid #PkDesktop instance
87 * @filename: a fully qualified filename
88 * @error: a #GError to put the error code and message in, or %NULL
89 *
90 * Returns the package name that owns the desktop file. Fast.
91 *
92 * Return value: package name, or %NULL
93 *
94 * NOTE: This method is unused and will be removed next time the library
95 * soname changes!
96 *
97 * Since: 0.5.3
98 **/
99 gchar *
100 pk_desktop_get_package_for_file (PkDesktop *desktop, const gchar *filename, GError **error)
101 {
102 g_set_error_literal (error, 1, 0, "no longer supported");
103 return NULL;
104 }
105
106 /**
107 * pk_desktop_open_database:
108 * @desktop: a valid #PkDesktop instance
109 * @error: a #GError to put the error code and message in, or %NULL
110 *
111 * This method is unused and will be removed next time the library
112 * soname changes!
113 *
114 * Return value: %TRUE if opened correctly
115 *
116 * Since: 0.5.3
117 **/
118 gboolean
119 pk_desktop_open_database (PkDesktop *desktop, GError **error)
120 {
121 return TRUE;
122 }
123
124 /*
125 * pk_desktop_class_init:
126 **/
127 static void
128 pk_desktop_class_init (PkDesktopClass *klass)
129 {
130 }
131
132 /*
133 * pk_desktop_init:
134 **/
135 static void
136 pk_desktop_init (PkDesktop *desktop)
137 {
138 desktop->priv = NULL;
139 }
140
141 /**
142 * pk_desktop_new:
143 *
144 * NOTE: This method is unused and will be removed next time the library
145 * soname changes!
146 *
147 * Since: 0.5.3
148 **/
149 PkDesktop *
150 pk_desktop_new (void)
151 {
152 if (pk_desktop_object != NULL) {
153 g_object_ref (pk_desktop_object);
154 } else {
155 pk_desktop_object = g_object_new (PK_TYPE_DESKTOP, NULL);
156 g_object_add_weak_pointer (pk_desktop_object, &pk_desktop_object);
157 }
158 return PK_DESKTOP (pk_desktop_object);
159 }