[packagekit] packagekit: Branch 'master'

Richard Hughes hughsient at kemper.freedesktop.org
Thu Sep 27 15:18:11 PDT 2007


 libpackagekit/pk-enum.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++
 libpackagekit/pk-enum.h |   20 ++++++++++++++++++
 2 files changed, 71 insertions(+)

New commits:
diff-tree 938516a1c62ceab52af454909d2edf238db5f606 (from 601f53fa434bfa45bc1ba95f23b81d51b0aaf87a)
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Sep 27 23:03:21 2007 +0100

    add some more enumerated types for the update type and frequency type

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 830c8e2..b1f4597 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -126,6 +126,21 @@ static PkTaskEnumMatch task_group[] = {
 	{0, NULL},
 };
 
+static PkTaskEnumMatch task_freq[] = {
+	{PK_FREQ_ENUM_HOURLY,			"hourly"},
+	{PK_FREQ_ENUM_WEEKLY,			"weekly"},
+	{PK_FREQ_ENUM_DAILY,			"daily"},
+	{PK_FREQ_ENUM_NEVER,			"never"},
+	{0, NULL},
+};
+
+static PkTaskEnumMatch task_update[] = {
+	{PK_UPDATE_ENUM_ALL,			"all"},
+	{PK_UPDATE_ENUM_SECURITY,		"security"},
+	{PK_UPDATE_ENUM_NONE,			"none"},
+	{0, NULL},
+};
+
 /**
  * pk_task_enum_find_value:
  */
@@ -283,6 +298,42 @@ pk_group_enum_to_text (PkGroupEnum group
 }
 
 /**
+ * pk_freq_enum_from_text:
+ **/
+PkFreqEnum
+pk_freq_enum_from_text (const gchar *freq)
+{
+	return pk_task_enum_find_value (task_freq, freq);
+}
+
+/**
+ * pk_freq_enum_to_text:
+ **/
+const gchar *
+pk_freq_enum_to_text (PkFreqEnum freq)
+{
+	return pk_task_enum_find_string (task_freq, freq);
+}
+
+/**
+ * pk_update_enum_from_text:
+ **/
+PkUpdateEnum
+pk_update_enum_from_text (const gchar *update)
+{
+	return pk_task_enum_find_value (task_update, update);
+}
+
+/**
+ * pk_update_enum_to_text:
+ **/
+const gchar *
+pk_update_enum_to_text (PkUpdateEnum update)
+{
+	return pk_task_enum_find_string (task_update, update);
+}
+
+/**
  * pk_filter_enum_from_text:
  **/
 PkFilterEnum
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 6028476..86ad347 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -115,6 +115,26 @@ typedef enum {
 	PK_GROUP_ENUM_UNKNOWN
 } PkGroupEnum;
 
+typedef enum {
+	PK_FREQ_ENUM_HOURLY,
+	PK_FREQ_ENUM_WEEKLY,
+	PK_FREQ_ENUM_DAILY,
+	PK_FREQ_ENUM_NEVER,
+	PK_FREQ_ENUM_UNKNOWN
+} PkFreqEnum;
+
+typedef enum {
+	PK_UPDATE_ENUM_ALL,
+	PK_UPDATE_ENUM_SECURITY,
+	PK_UPDATE_ENUM_NONE,
+} PkUpdateEnum;
+
+PkUpdateEnum	 pk_update_enum_from_text		(const gchar	*update);
+const gchar	*pk_update_enum_to_text			(PkUpdateEnum	 update);
+
+PkFreqEnum	 pk_freq_enum_from_text			(const gchar	*freq);
+const gchar	*pk_freq_enum_to_text			(PkFreqEnum	 freq);
+
 PkExitEnum	 pk_exit_enum_from_text			(const gchar	*exit);
 const gchar	*pk_exit_enum_to_text			(PkExitEnum	 exit);
 



More information about the PackageKit mailing list