Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=gfpm.git;a=commitdiff;h=79932f4da629497858cac5352cf9ca98c03337a0

commit 79932f4da629497858cac5352cf9ca98c03337a0
Author: Priyank <[EMAIL PROTECTED]>
Date:   Sat Jul 5 12:24:58 2008 +0530

gfpm-prefs: initial import

diff --git a/src/Makefile.am b/src/Makefile.am
index e18c626..03da0bd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ gfpm_SOURCES=                         \
gfpm-icmonitor.c \
gfpm-repomanager.c \
gfpm-logviewer.c \
+                       gfpm-prefs.c \
gfpm.c

gfpm_LDADD= @GFPM_LIBS@ -lpacman -linotifytools -lfwutil
diff --git a/src/gfpm-interface.c b/src/gfpm-interface.c
index cf1d86d..5ef4578 100644
--- a/src/gfpm-interface.c
+++ b/src/gfpm-interface.c
@@ -46,6 +46,7 @@
#include "gfpm-util.h"
#include "gfpm-about.h"
#include "gfpm-db.h"
+#include "gfpm-prefs.h"

extern GladeXML *xml;
extern PM_DB    *sync_db;
@@ -357,6 +358,7 @@ gfpm_interface_init (void)
gfpm_quickpane_init ();
gfpm_icmonitor_init ();
gfpm_logviewer_init ();
+       gfpm_prefs_init ();

gtk_widget_hide (gfpm_splash);
title = g_strdup_printf ("%s (%s)", PACKAGE_STRING, GFPM_RELEASE_NAME);
diff --git a/src/gfpm-prefs.c b/src/gfpm-prefs.c
new file mode 100644
index 0000000..7ffcb0a
--- /dev/null
+++ b/src/gfpm-prefs.c
@@ -0,0 +1,107 @@
+/*
+ *  gfpm-prefs.c for gfpm
+ *
+ *  Copyright (C) 2008 by Priyank Gosalia <[EMAIL PROTECTED]>
+ *
+ *  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 "gfpm-prefs.h"
+#include "gfpm-messages.h"
+#include "gfpm-interface.h"
+#include "gfpm-util.h"
+#include "gfpm-db.h"
+
+
+static GtkWidget *gfpm_prefs_log_check;
+static GtkWidget *gfpm_prefs_log_location;
+
+static GtkWidget *gfpm_prefs_holdpkg_tvw;
+static GtkWidget *gfpm_prefs_ignorepkg_tvw;
+
+static GList *gfpm_prefs_holdpkg_list = NULL;
+static GList *gfpm_prefs_ignorepkg_list = NULL;
+
+
+static void gfpm_prefs_populate_holdpkg (void);
+
+void
+gfpm_prefs_init (void)
+{
+       gfpm_prefs_holdpkg_tvw = gfpm_get_widget ("gfpm_prefs_holdpkg_tvw");
+       gfpm_prefs_ignorepkg_tvw = gfpm_get_widget ("gfpm_prefs_ignorepkg_tvw");
+
+       gfpm_prefs_populate_holdpkg ();
+       while (gfpm_prefs_holdpkg_list != NULL)
+       {
+               g_print ("%s\n", (char*)gfpm_prefs_holdpkg_list->data);
+               gfpm_prefs_holdpkg_list = gfpm_prefs_holdpkg_list->next;
+       }
+
+       return;
+}
+
+static void
+gfpm_prefs_populate_holdpkg (void)
+{
+       PM_LIST *list = NULL;
+       long    data;
+
+       /* free the old list */
+       if (gfpm_prefs_holdpkg_list != NULL)
+               g_list_free (gfpm_prefs_holdpkg_list);
+
+       /* populate the new list */
+       pacman_parse_config (CFG_FILE, NULL, "");
+       if (!pacman_get_option(PM_OPT_HOLDPKG, &data))
+       {
+               list = (PM_LIST*)data;
+               while (list != NULL)
+               {
+                       gfpm_prefs_holdpkg_list = g_list_append 
(gfpm_prefs_holdpkg_list,
+                                                               
g_strdup(pacman_list_getdata(list)));
+                       list = pacman_list_next (list);
+               }
+       }
+
+       return;
+}
+
+static void
+gfpm_prefs_populate_ignorepkg (void)
+{
+       PM_LIST *list = NULL;
+       long    data;
+
+       /* free the old list */
+       if (gfpm_prefs_ignorepkg_list != NULL)
+               g_list_free (gfpm_prefs_ignorepkg_list);
+
+       /* populate the new list */
+       pacman_parse_config (CFG_FILE, NULL, "");
+       if (!pacman_get_option(PM_OPT_IGNOREPKG, &data))
+       {
+               list = (PM_LIST*)data;
+               while (list != NULL)
+               {
+                       gfpm_prefs_ignorepkg_list = g_list_append 
(gfpm_prefs_ignorepkg_list,
+                                                                       
g_strdup(pacman_list_getdata(list)));
+                       list = pacman_list_next (list);
+               }
+       }
+
+       return;
+}
+
diff --git a/src/gfpm-prefs.h b/src/gfpm-prefs.h
new file mode 100644
index 0000000..7b29e7d
--- /dev/null
+++ b/src/gfpm-prefs.h
@@ -0,0 +1,15 @@
+#ifndef __GFPM_PREFS_H__
+#define __GFPM_PREFS_H__
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <locale.h>
+#include <libintl.h>
+#include <gtk/gtk.h>
+#include <libfwutil.h>
+
+void gfpm_prefs_init (void);
+
+#endif
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to