[packagekit] packagekit: Branch 'master' - 6 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Feb 3 23:48:43 PST 2008
client/Makefile.am | 2
client/pk-import-common.c | 51 ++++++++++
client/pk-import-common.h | 30 ++++++
client/pk-import-desktop.c | 31 +-----
libpackagekit/Makefile.am | 3
libpackagekit/pk-extra-obj.c | 197 ++++++++++++++++++++++++++++++++++++++++++
libpackagekit/pk-extra-obj.h | 45 +++++++++
libpackagekit/pk-extra.c | 15 ++-
libpackagekit/pk-extra.h | 3
libpackagekit/pk-package-id.c | 4
libpackagekit/pk-self-test.c | 2
11 files changed, 348 insertions(+), 35 deletions(-)
New commits:
commit bf8f0d87e7802ac36c22ad31198c2f10e1518658
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 23:11:02 2008 +0000
abstact out some import common files for future use
diff --git a/client/Makefile.am b/client/Makefile.am
index b6d8022..622e8de 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -55,6 +55,8 @@ pkmon_LDADD = \
$(NULL)
pk_import_desktop_SOURCES = \
+ pk-import-common.c \
+ pk-import-common.h \
pk-import-desktop.c \
$(NULL)
diff --git a/client/pk-import-common.c b/client/pk-import-common.c
new file mode 100644
index 0000000..5a37f51
--- /dev/null
+++ b/client/pk-import-common.c
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include <glib.h>
+
+#include <pk-debug.h>
+#include "pk-import-common.h"
+
+GPtrArray *
+pk_import_get_locale_list (void)
+{
+ GDir *dir;
+ const gchar *name;
+ GPtrArray *locale_array;
+
+ locale_array = g_ptr_array_new ();
+
+ dir = g_dir_open (PK_IMPORT_LOCALEDIR, 0, NULL);
+ if (dir == NULL) {
+ pk_error ("not a valid locale dir!");
+ }
+
+ name = g_dir_read_name (dir);
+ while (name != NULL) {
+ pk_debug ("locale=%s", name);
+ name = g_dir_read_name (dir);
+ g_ptr_array_add (locale_array, g_strdup (name));
+ }
+ g_dir_close (dir);
+ return locale_array;
+}
+
diff --git a/client/pk-import-common.h b/client/pk-import-common.h
new file mode 100644
index 0000000..72ab48f
--- /dev/null
+++ b/client/pk-import-common.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_IMPORT_COMMON_H
+#define __PK_IMPORT_COMMON_H
+
+#define PK_IMPORT_APPLICATIONSDIR "/usr/share/applications"
+#define PK_IMPORT_LOCALEDIR "/usr/share/locale"
+
+GPtrArray *pk_import_get_locale_list (void);
+
+#endif /* __PK_IMPORT_COMMON_H */
diff --git a/client/pk-import-desktop.c b/client/pk-import-desktop.c
index 176b183..753e9e8 100644
--- a/client/pk-import-desktop.c
+++ b/client/pk-import-desktop.c
@@ -34,7 +34,7 @@
#include <pk-package-id.h>
#include <pk-extra.h>
-#define PK_EXTRA_DESKTOP_DATABASE "/usr/share/applications"
+#include "pk-import-common.h"
static PkClient *client = NULL;
static PkExtra *extra = NULL;
@@ -176,28 +176,6 @@ pk_desktop_process_directory (const gchar *directory)
g_dir_close (dir);
}
-static void
-pk_desktop_get_locale_list (const gchar *directory)
-{
- GDir *dir;
- const gchar *name;
-
- locale_array = g_ptr_array_new ();
-
- dir = g_dir_open (directory, 0, NULL);
- if (dir == NULL) {
- pk_error ("not a valid locale dir!");
- }
-
- name = g_dir_read_name (dir);
- while (name != NULL) {
- pk_debug ("locale=%s", name);
- name = g_dir_read_name (dir);
- g_ptr_array_add (locale_array, g_strdup (name));
- }
- g_dir_close (dir);
-}
-
/**
* main:
**/
@@ -215,7 +193,7 @@ main (int argc, char *argv[])
{ "database-location", '\0', 0, G_OPTION_ARG_STRING, &database_location,
"Database location (default set from daemon)", NULL },
{ "desktop-location", '\0', 0, G_OPTION_ARG_STRING, &desktop_location,
- "Desktop location (default " PK_EXTRA_DESKTOP_DATABASE ")", NULL },
+ "Desktop location (default " PK_IMPORT_APPLICATIONSDIR ")", NULL },
{ NULL}
};
@@ -228,11 +206,11 @@ main (int argc, char *argv[])
pk_debug_init (verbose);
- pk_desktop_get_locale_list ("/usr/share/locale");
+ locale_array = pk_import_get_locale_list ();
/* set defaults */
if (desktop_location == NULL) {
- desktop_location = PK_EXTRA_DESKTOP_DATABASE;
+ desktop_location = PK_IMPORT_APPLICATIONSDIR;
}
client = pk_client_new ();
commit ede5b3cdc9accf2a241ad120df55568fc6f78b3c
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 20:29:40 2008 +0000
trivial - use a smaller name for extra-obj
diff --git a/libpackagekit/pk-extra-obj.c b/libpackagekit/pk-extra-obj.c
index 6d800fa..0d6c095 100644
--- a/libpackagekit/pk-extra-obj.c
+++ b/libpackagekit/pk-extra-obj.c
@@ -50,13 +50,13 @@
PkExtraObj *
pk_extra_obj_new (void)
{
- PkExtraObj *extra_obj;
- extra_obj = g_new0 (PkExtraObj, 1);
- extra_obj->id = NULL;
- extra_obj->icon = NULL;
- extra_obj->exec = NULL;
- extra_obj->summary = NULL;
- return extra_obj;
+ PkExtraObj *eobj;
+ eobj = g_new0 (PkExtraObj, 1);
+ eobj->id = NULL;
+ eobj->icon = NULL;
+ eobj->exec = NULL;
+ eobj->summary = NULL;
+ return eobj;
}
/**
@@ -71,17 +71,18 @@ PkExtraObj *
pk_extra_obj_new_from_package_id (const gchar *package_id)
{
PkExtra *extra;
- PkExtraObj *extra_obj;
+ PkExtraObj *eobj;
- extra_obj = pk_extra_obj_new ();
- extra_obj->id = pk_package_id_new_from_string (package_id);
+ eobj = pk_extra_obj_new ();
+ eobj->id = pk_package_id_new_from_string (package_id);
extra = pk_extra_new ();
- pk_extra_get_localised_detail (extra, extra_obj->id->name, &extra_obj->summary, NULL, NULL);
- pk_extra_get_package_detail (extra, extra_obj->id->name, &extra_obj->icon, &extra_obj->exec);
+ pk_debug ("getting localised for %s", eobj->id->name);
+ pk_extra_get_localised_detail (extra, eobj->id->name, &eobj->summary, NULL, NULL);
+ pk_extra_get_package_detail (extra, eobj->id->name, &eobj->icon, &eobj->exec);
g_object_unref (extra);
- return extra_obj;
+ return eobj;
}
/**
@@ -95,13 +96,13 @@ pk_extra_obj_new_from_package_id (const gchar *package_id)
PkExtraObj *
pk_extra_obj_new_from_package_id_summary (const gchar *package_id, const gchar *summary)
{
- PkExtraObj *extra_obj;
- extra_obj = pk_extra_obj_new_from_package_id (package_id);
+ PkExtraObj *eobj;
+ eobj = pk_extra_obj_new_from_package_id (package_id);
/* nothing better */
- if (extra_obj->summary == NULL) {
- extra_obj->summary = g_strdup (summary);
+ if (eobj->summary == NULL) {
+ eobj->summary = g_strdup (summary);
}
- return extra_obj;
+ return eobj;
}
/**
@@ -111,18 +112,18 @@ pk_extra_obj_new_from_package_id_summary (const gchar *package_id, const gchar *
* Return value: %TRUE if the #PkExtraObj object was freed.
**/
gboolean
-pk_extra_obj_free (PkExtraObj *extra_obj)
+pk_extra_obj_free (PkExtraObj *eobj)
{
- if (extra_obj == NULL) {
+ if (eobj == NULL) {
return FALSE;
}
- if (extra_obj->id != NULL) {
- pk_package_id_free (extra_obj->id);
+ if (eobj->id != NULL) {
+ pk_package_id_free (eobj->id);
}
- g_free (extra_obj->icon);
- g_free (extra_obj->exec);
- g_free (extra_obj->summary);
- g_free (extra_obj);
+ g_free (eobj->icon);
+ g_free (eobj->exec);
+ g_free (eobj->summary);
+ g_free (eobj);
return TRUE;
}
@@ -137,7 +138,7 @@ libst_extra_obj (LibSelfTest *test)
{
gboolean ret;
PkExtra *extra;
- PkExtraObj *extra_obj;
+ PkExtraObj *eobj;
if (libst_start (test, "PkExtraObj", CLASS_AUTO) == FALSE) {
return;
@@ -150,8 +151,8 @@ libst_extra_obj (LibSelfTest *test)
/************************************************************/
libst_title (test, "get an extra_obj object");
- extra_obj = pk_extra_obj_new_from_package_id ("gnome-power-manager;0.0.1;i386;fedora");
- if (extra_obj != NULL) {
+ eobj = pk_extra_obj_new_from_package_id ("gnome-power-manager;0.0.1;i386;fedora");
+ if (eobj != NULL) {
libst_success (test, NULL);
} else {
libst_failed (test, NULL);
@@ -159,31 +160,31 @@ libst_extra_obj (LibSelfTest *test)
/************************************************************/
libst_title (test, "got an icon");
- if (extra_obj->icon != NULL) {
- libst_success (test, "got %s", extra_obj->icon);
+ if (eobj->icon != NULL) {
+ libst_success (test, "got %s", eobj->icon);
} else {
libst_failed (test, NULL);
}
/************************************************************/
libst_title (test, "got an exec");
- if (extra_obj->exec != NULL) {
- libst_success (test, "got %s", extra_obj->exec);
+ if (eobj->exec != NULL) {
+ libst_success (test, "got %s", eobj->exec);
} else {
libst_failed (test, NULL);
}
/************************************************************/
libst_title (test, "got an summary");
- if (extra_obj->summary != NULL) {
- libst_success (test, "got %s", extra_obj->summary);
+ if (eobj->summary != NULL) {
+ libst_success (test, "got %s", eobj->summary);
} else {
libst_failed (test, NULL);
}
/************************************************************/
- libst_title (test, "free extra_obj");
- ret = pk_extra_obj_free (extra_obj);
+ libst_title (test, "free eobj");
+ ret = pk_extra_obj_free (eobj);
if (ret == TRUE) {
libst_success (test, NULL);
} else {
commit e2c8bbcd06d611ba3fb01882f87325d63d215960
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 20:15:59 2008 +0000
add a convenience object to access PkExtra data without being single instance
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index fdf3c84..86ccc5b 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -34,6 +34,7 @@ libpackagekit_includedir = $(includedir)/packagekit
libpackagekit_include_HEADERS = \
pk-debug.h \
pk-extra.h \
+ pk-extra-obj.h \
pk-connection.h \
pk-network.h \
pk-package-id.h \
@@ -54,6 +55,8 @@ libpackagekit_la_SOURCES = \
pk-marshal.h \
pk-extra.c \
pk-extra.h \
+ pk-extra-obj.c \
+ pk-extra-obj.h \
pk-connection.c \
pk-connection.h \
pk-network.h \
diff --git a/libpackagekit/pk-extra-obj.c b/libpackagekit/pk-extra-obj.c
new file mode 100644
index 0000000..6d800fa
--- /dev/null
+++ b/libpackagekit/pk-extra-obj.c
@@ -0,0 +1,196 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:pk-package-id
+ * @short_description: Functionality to modify a PackageID
+ *
+ * ExtraObject's are difficult to read and create.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <glib/gi18n.h>
+
+#include "pk-debug.h"
+#include "pk-common.h"
+#include "pk-package-id.h"
+#include "pk-extra.h"
+#include "pk-extra-obj.h"
+
+/**
+ * pk_extra_obj_new:
+ *
+ * Creates a new #PkExtraObj object with default values
+ *
+ * Return value: a new #PkExtraObj object
+ **/
+PkExtraObj *
+pk_extra_obj_new (void)
+{
+ PkExtraObj *extra_obj;
+ extra_obj = g_new0 (PkExtraObj, 1);
+ extra_obj->id = NULL;
+ extra_obj->icon = NULL;
+ extra_obj->exec = NULL;
+ extra_obj->summary = NULL;
+ return extra_obj;
+}
+
+/**
+ * pk_extra_obj_new_from_package_id:
+ * @package_id: the package_id to pre-fill the object
+ *
+ * Creates a new #PkExtraObj object with values taken from the supplied id.
+ *
+ * Return value: a new #PkExtraObj object
+ **/
+PkExtraObj *
+pk_extra_obj_new_from_package_id (const gchar *package_id)
+{
+ PkExtra *extra;
+ PkExtraObj *extra_obj;
+
+ extra_obj = pk_extra_obj_new ();
+ extra_obj->id = pk_package_id_new_from_string (package_id);
+
+ extra = pk_extra_new ();
+ pk_extra_get_localised_detail (extra, extra_obj->id->name, &extra_obj->summary, NULL, NULL);
+ pk_extra_get_package_detail (extra, extra_obj->id->name, &extra_obj->icon, &extra_obj->exec);
+ g_object_unref (extra);
+
+ return extra_obj;
+}
+
+/**
+ * pk_extra_obj_new_from_package_id_summary:
+ * @package_id: the package_id to pre-fill the object
+ *
+ * Creates a new #PkExtraObj object with values taken from the supplied id.
+ *
+ * Return value: a new #PkExtraObj object
+ **/
+PkExtraObj *
+pk_extra_obj_new_from_package_id_summary (const gchar *package_id, const gchar *summary)
+{
+ PkExtraObj *extra_obj;
+ extra_obj = pk_extra_obj_new_from_package_id (package_id);
+ /* nothing better */
+ if (extra_obj->summary == NULL) {
+ extra_obj->summary = g_strdup (summary);
+ }
+ return extra_obj;
+}
+
+/**
+ * pk_extra_obj_free:
+ * @extra_obj: the #PkExtraObj object
+ *
+ * Return value: %TRUE if the #PkExtraObj object was freed.
+ **/
+gboolean
+pk_extra_obj_free (PkExtraObj *extra_obj)
+{
+ if (extra_obj == NULL) {
+ return FALSE;
+ }
+ if (extra_obj->id != NULL) {
+ pk_package_id_free (extra_obj->id);
+ }
+ g_free (extra_obj->icon);
+ g_free (extra_obj->exec);
+ g_free (extra_obj->summary);
+ g_free (extra_obj);
+ return TRUE;
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef PK_BUILD_TESTS
+#include <libselftest.h>
+
+void
+libst_extra_obj (LibSelfTest *test)
+{
+ gboolean ret;
+ PkExtra *extra;
+ PkExtraObj *extra_obj;
+
+ if (libst_start (test, "PkExtraObj", CLASS_AUTO) == FALSE) {
+ return;
+ }
+
+ /* should be single instance */
+ extra = pk_extra_new ();
+ pk_extra_set_database (extra, PK_EXTRA_DEFAULT_DATABASE);
+ pk_extra_set_locale (extra, "fr");
+
+ /************************************************************/
+ libst_title (test, "get an extra_obj object");
+ extra_obj = pk_extra_obj_new_from_package_id ("gnome-power-manager;0.0.1;i386;fedora");
+ if (extra_obj != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "got an icon");
+ if (extra_obj->icon != NULL) {
+ libst_success (test, "got %s", extra_obj->icon);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "got an exec");
+ if (extra_obj->exec != NULL) {
+ libst_success (test, "got %s", extra_obj->exec);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "got an summary");
+ if (extra_obj->summary != NULL) {
+ libst_success (test, "got %s", extra_obj->summary);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "free extra_obj");
+ ret = pk_extra_obj_free (extra_obj);
+ if (ret == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ libst_end (test);
+}
+#endif
+
diff --git a/libpackagekit/pk-extra-obj.h b/libpackagekit/pk-extra-obj.h
new file mode 100644
index 0000000..0d9025c
--- /dev/null
+++ b/libpackagekit/pk-extra-obj.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_EXTRA_OBJ_H
+#define __PK_EXTRA_OBJ_H
+
+#include <glib-object.h>
+#include "pk-package-id.h"
+
+G_BEGIN_DECLS
+
+typedef struct {
+ PkPackageId *id;
+ gchar *icon;
+ gchar *exec;
+ gchar *summary; /* one line quick description */
+} PkExtraObj;
+
+PkExtraObj *pk_extra_obj_new (void);
+PkExtraObj *pk_extra_obj_new_from_package_id (const gchar *package_id);
+PkExtraObj *pk_extra_obj_new_from_package_id_summary (const gchar *package_id,
+ const gchar *summary);
+gboolean pk_extra_obj_free (PkExtraObj *extra_obj);
+
+G_END_DECLS
+
+#endif /* __PK_EXTRA_OBJ_H */
diff --git a/libpackagekit/pk-self-test.c b/libpackagekit/pk-self-test.c
index e99c260..626e17a 100644
--- a/libpackagekit/pk-self-test.c
+++ b/libpackagekit/pk-self-test.c
@@ -32,6 +32,7 @@ void libst_enum (LibSelfTest *test);
void libst_common (LibSelfTest *test);
void libst_enum_list (LibSelfTest *test);
void libst_extra (LibSelfTest *test);
+void libst_extra_obj (LibSelfTest *test);
int
main (int argc, char **argv)
@@ -48,6 +49,7 @@ main (int argc, char **argv)
libst_enum (&test);
libst_enum_list (&test);
libst_extra (&test);
+ libst_extra_obj (&test);
return (libst_finish (&test));
}
commit 9fb9b674ac3b0672f633d14e9de5e9abfe15dae6
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 19:59:05 2008 +0000
make PkExtra a singleton
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index 382600e..1df07fb 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -62,6 +62,7 @@ struct PkExtraPrivate
};
G_DEFINE_TYPE (PkExtra, pk_extra, G_TYPE_OBJECT)
+static gpointer pk_extra_object = NULL;
/**
* pk_extra_set_locale:
@@ -508,9 +509,13 @@ pk_extra_finalize (GObject *object)
PkExtra *
pk_extra_new (void)
{
- PkExtra *extra;
- extra = g_object_new (PK_TYPE_EXTRA, NULL);
- return PK_EXTRA (extra);
+ if (pk_extra_object != NULL) {
+ g_object_ref (pk_extra_object);
+ } else {
+ pk_extra_object = g_object_new (PK_TYPE_EXTRA, NULL);
+ g_object_add_weak_pointer (pk_extra_object, &pk_extra_object);
+ }
+ return PK_EXTRA (pk_extra_object);
}
/***************************************************************************
commit 93e7b294f087e6f1490235cd69120a61dc724a97
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 19:49:49 2008 +0000
export a default extra-db location for client programs
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index 0b157f1..382600e 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -42,7 +42,7 @@ static void pk_extra_init (PkExtra *extra);
static void pk_extra_finalize (GObject *object);
#define PK_EXTRA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_EXTRA, PkExtraPrivate))
-#define PK_EXTRA_DEFAULT_DATABASE PK_DB_DIR "/extra-data.db"
+#define PK_EXTRA_DEFAULT_DATABASE_INTERNAL PK_DB_DIR "/extra-data.db"
/**
* PkExtraPrivate:
@@ -407,7 +407,7 @@ pk_extra_set_database (PkExtra *extra, const gchar *filename)
/* if this is NULL, then assume default */
if (filename == NULL) {
- filename = PK_EXTRA_DEFAULT_DATABASE;
+ filename = PK_EXTRA_DEFAULT_DATABASE_INTERNAL;
}
/* save for later */
diff --git a/libpackagekit/pk-extra.h b/libpackagekit/pk-extra.h
index 1ebb31a..493a8da 100644
--- a/libpackagekit/pk-extra.h
+++ b/libpackagekit/pk-extra.h
@@ -36,6 +36,9 @@ G_BEGIN_DECLS
#define PK_IS_EXTRA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_EXTRA))
#define PK_EXTRA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_EXTRA, PkExtraClass))
+/* convenience */
+#define PK_EXTRA_DEFAULT_DATABASE "/var/lib/PackageKit/extra-data.db"
+
typedef struct PkExtraPrivate PkExtraPrivate;
typedef struct
commit 0f05b9f68fe52b24763e5f4741399a1b9fad9d06
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 3 19:19:37 2008 +0000
fix some ITS4 checks
diff --git a/client/pk-import-desktop.c b/client/pk-import-desktop.c
index c6591d1..176b183 100644
--- a/client/pk-import-desktop.c
+++ b/client/pk-import-desktop.c
@@ -158,6 +158,7 @@ pk_desktop_process_directory (const gchar *directory)
pattern = g_pattern_spec_new ("*.desktop");
name = g_dir_read_name (dir);
while (name != NULL) {
+ /* ITS4: ignore, not used for allocation */
match = g_pattern_match (pattern, strlen (name), name, NULL);
if (match == TRUE) {
filename = g_build_filename (directory, name, NULL);
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index b5e3213..8f97d97 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -96,19 +96,15 @@ pk_package_id_new_from_string (const gchar *package_id)
/* create new object */
ident = pk_package_id_new ();
- /* ITS4: ignore, not used for allocation */
if (pk_strzero (sections[0]) == FALSE) {
ident->name = g_strdup (sections[0]);
}
- /* ITS4: ignore, not used for allocation */
if (pk_strzero (sections[1]) == FALSE) {
ident->version = g_strdup (sections[1]);
}
- /* ITS4: ignore, not used for allocation */
if (pk_strzero (sections[2]) == FALSE) {
ident->arch = g_strdup (sections[2]);
}
- /* ITS4: ignore, not used for allocation */
if (pk_strzero (sections[3]) == FALSE) {
ident->data = g_strdup (sections[3]);
}
More information about the PackageKit
mailing list