summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2010-02-06 22:54:50 (GMT)
committerJason Woodward2010-02-07 00:09:37 (GMT)
commitb1865781123c5f4bdbc2aeb1b33fbf4819f0e8b4 (patch)
treecd220502bc191e78e6cefd233c47cae226be636f
parentddf5d647944fcb5169c299f108ca16e5e69f31a8 (diff)
downloadgslapt-b1865781123c5f4bdbc2aeb1b33fbf4819f0e8b4.tar.gz
added slackware location/series mapping that uses a friendlier label for the slackware package series names
-rw-r--r--ChangeLog2
-rw-r--r--Makefile.am2
-rw-r--r--series_map.rc358
-rw-r--r--src/Makefile.am1
-rw-r--r--src/callbacks.c40
-rw-r--r--src/callbacks.h1
-rw-r--r--src/main.c6
-rw-r--r--src/series.c83
-rw-r--r--src/series.h14
9 files changed, 498 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c1d73d..9bedc7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
0.5.3 Feb 06, 2010
+ * added slackware location/series mapping that uses a friendlier label for the
+ slackware package series names
* use column constants with the Gtk tree model
0.5.2b Jan 14, 2010
diff --git a/Makefile.am b/Makefile.am
index 997f234..9d95969 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,11 +11,13 @@ EXTRA_DIST = \
install-data-local:
@$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)/$(pkgdatadir); \
$(mkinstalldirs) $(DESTDIR)/$(datadir)/applications; \
$(mkinstalldirs) $(DESTDIR)/$(datadir)/doc/@PACKAGE@ ; \
$(INSTALL_DATA) AUTHORS ChangeLog COPYING FAQ README $(DESTDIR)/$(datadir)/doc/@PACKAGE@ ; \
$(INSTALL_DATA) gslapt.desktop $(DESTDIR)/$(datadir)/applications/gslapt.desktop; \
$(INSTALL_DATA) gslapt-kde.desktop $(DESTDIR)/$(datadir)/applications/gslapt-kde.desktop; \
+ $(INSTALL_DATA) series_map.rc $(DESTDIR)/$(pkgdatadir)/; \
$(mkinstalldirs) $(DESTDIR)/$(datadir)/pixmaps; \
$(INSTALL_DATA) pixmaps/gslapt.png $(DESTDIR)/$(datadir)/pixmaps/; \
if test -d $(srcdir)/pixmaps; then \
diff --git a/series_map.rc b/series_map.rc
new file mode 100644
index 0000000..778b689
--- /dev/null
+++ b/series_map.rc
@@ -0,0 +1,358 @@
+[series mappings]
+./slackware/a=Base
+./slackware/a[bg]=Base
+./slackware/a[de]=Base
+./slackware/a[el]=Base
+./slackware/a[es]=Base
+./slackware/a[fr]=Base
+./slackware/a[gl_ES]=Base
+./slackware/a[id]=Base
+./slackware/a[it]=Base
+./slackware/a[ja]=Base
+./slackware/a[nl]=Base
+./slackware/a[pl]=Base
+./slackware/a[pt_BR]=Base
+./slackware/a[pt]=Base
+./slackware/a[ru]=Base
+./slackware/a[sk]=Base
+./slackware/a[sv]=Base
+./slackware/a[tr]=Base
+./slackware/a[uk]=Base
+./slackware/a[vi]=Base
+./slackware/a[zh_CN]=Base
+./slackware/ap=Applications
+./slackware/ap[bg]=Applications
+./slackware/ap[de]=Applications
+./slackware/ap[el]=Applications
+./slackware/ap[es]=Applications
+./slackware/ap[fr]=Applications
+./slackware/ap[gl_ES]=Applications
+./slackware/ap[id]=Applications
+./slackware/ap[it]=Applications
+./slackware/ap[ja]=Applications
+./slackware/ap[nl]=Applications
+./slackware/ap[pl]=Applications
+./slackware/ap[pt_BR]=Applications
+./slackware/ap[pt]=Applications
+./slackware/ap[ru]=Applications
+./slackware/ap[sk]=Applications
+./slackware/ap[sv]=Applications
+./slackware/ap[tr]=Applications
+./slackware/ap[uk]=Applications
+./slackware/ap[vi]=Applications
+./slackware/ap[zh_CN]=Applications
+./slackware/d=Development Tools
+./slackware/d[bg]=Development Tools
+./slackware/d[de]=Development Tools
+./slackware/d[el]=Development Tools
+./slackware/d[es]=Development Tools
+./slackware/d[fr]=Development Tools
+./slackware/d[gl_ES]=Development Tools
+./slackware/d[id]=Development Tools
+./slackware/d[it]=Development Tools
+./slackware/d[ja]=Development Tools
+./slackware/d[nl]=Development Tools
+./slackware/d[pl]=Development Tools
+./slackware/d[pt_BR]=Development Tools
+./slackware/d[pt]=Development Tools
+./slackware/d[ru]=Development Tools
+./slackware/d[sk]=Development Tools
+./slackware/d[sv]=Development Tools
+./slackware/d[tr]=Development Tools
+./slackware/d[uk]=Development Tools
+./slackware/d[vi]=Development Tools
+./slackware/d[zh_CN]=Development Tools
+./slackware/e=GNU Emacs
+./slackware/e[bg]=GNU Emacs
+./slackware/e[de]=GNU Emacs
+./slackware/e[el]=GNU Emacs
+./slackware/e[es]=GNU Emacs
+./slackware/e[fr]=GNU Emacs
+./slackware/e[gl_ES]=GNU Emacs
+./slackware/e[id]=GNU Emacs
+./slackware/e[it]=GNU Emacs
+./slackware/e[ja]=GNU Emacs
+./slackware/e[nl]=GNU Emacs
+./slackware/e[pl]=GNU Emacs
+./slackware/e[pt_BR]=GNU Emacs
+./slackware/e[pt]=GNU Emacs
+./slackware/e[ru]=GNU Emacs
+./slackware/e[sk]=GNU Emacs
+./slackware/e[sv]=GNU Emacs
+./slackware/e[tr]=GNU Emacs
+./slackware/e[uk]=GNU Emacs
+./slackware/e[vi]=GNU Emacs
+./slackware/e[zh_CN]=GNU Emacs
+./slackware/f=Documentation
+./slackware/f[bg]=Documentation
+./slackware/f[de]=Documentation
+./slackware/f[el]=Documentation
+./slackware/f[es]=Documentation
+./slackware/f[fr]=Documentation
+./slackware/f[gl_ES]=Documentation
+./slackware/f[id]=Documentation
+./slackware/f[it]=Documentation
+./slackware/f[ja]=Documentation
+./slackware/f[nl]=Documentation
+./slackware/f[pl]=Documentation
+./slackware/f[pt_BR]=Documentation
+./slackware/f[pt]=Documentation
+./slackware/f[ru]=Documentation
+./slackware/f[sk]=Documentation
+./slackware/f[sv]=Documentation
+./slackware/f[tr]=Documentation
+./slackware/f[uk]=Documentation
+./slackware/f[vi]=Documentation
+./slackware/f[zh_CN]=Documentation
+./slackware/gnome=GNOME
+./slackware/gnome[bg]=GNOME
+./slackware/gnome[de]=GNOME
+./slackware/gnome[el]=GNOME
+./slackware/gnome[es]=GNOME
+./slackware/gnome[fr]=GNOME
+./slackware/gnome[gl_ES]=GNOME
+./slackware/gnome[id]=GNOME
+./slackware/gnome[it]=GNOME
+./slackware/gnome[ja]=GNOME
+./slackware/gnome[nl]=GNOME
+./slackware/gnome[pl]=GNOME
+./slackware/gnome[pt_BR]=GNOME
+./slackware/gnome[pt]=GNOME
+./slackware/gnome[ru]=GNOME
+./slackware/gnome[sk]=GNOME
+./slackware/gnome[sv]=GNOME
+./slackware/gnome[tr]=GNOME
+./slackware/gnome[uk]=GNOME
+./slackware/gnome[vi]=GNOME
+./slackware/gnome[zh_CN]=GNOME
+./slackware/k=Linux kernel
+./slackware/k[bg]=Linux kernel
+./slackware/k[de]=Linux kernel
+./slackware/k[el]=Linux kernel
+./slackware/k[es]=Linux kernel
+./slackware/k[fr]=Linux kernel
+./slackware/k[gl_ES]=Linux kernel
+./slackware/k[id]=Linux kernel
+./slackware/k[it]=Linux kernel
+./slackware/k[ja]=Linux kernel
+./slackware/k[nl]=Linux kernel
+./slackware/k[pl]=Linux kernel
+./slackware/k[pt_BR]=Linux kernel
+./slackware/k[pt]=Linux kernel
+./slackware/k[ru]=Linux kernel
+./slackware/k[sk]=Linux kernel
+./slackware/k[sv]=Linux kernel
+./slackware/k[tr]=Linux kernel
+./slackware/k[uk]=Linux kernel
+./slackware/k[vi]=Linux kernel
+./slackware/k[zh_CN]=Linux kernel
+./slackware/kde=KDE
+./slackware/kde[bg]=KDE
+./slackware/kde[de]=KDE
+./slackware/kde[el]=KDE
+./slackware/kde[es]=KDE
+./slackware/kde[fr]=KDE
+./slackware/kde[gl_ES]=KDE
+./slackware/kde[id]=KDE
+./slackware/kde[it]=KDE
+./slackware/kde[ja]=KDE
+./slackware/kde[nl]=KDE
+./slackware/kde[pl]=KDE
+./slackware/kde[pt_BR]=KDE
+./slackware/kde[pt]=KDE
+./slackware/kde[ru]=KDE
+./slackware/kde[sk]=KDE
+./slackware/kde[sv]=KDE
+./slackware/kde[tr]=KDE
+./slackware/kde[uk]=KDE
+./slackware/kde[vi]=KDE
+./slackware/kde[zh_CN]=KDE
+./slackware/kdei=KDE Internationalization
+./slackware/kdei[bg]=KDE Internationalization
+./slackware/kdei[de]=KDE Internationalization
+./slackware/kdei[el]=KDE Internationalization
+./slackware/kdei[es]=KDE Internationalization
+./slackware/kdei[fr]=KDE Internationalization
+./slackware/kdei[gl_ES]=KDE Internationalization
+./slackware/kdei[id]=KDE Internationalization
+./slackware/kdei[it]=KDE Internationalization
+./slackware/kdei[ja]=KDE Internationalization
+./slackware/kdei[nl]=KDE Internationalization
+./slackware/kdei[pl]=KDE Internationalization
+./slackware/kdei[pt_BR]=KDE Internationalization
+./slackware/kdei[pt]=KDE Internationalization
+./slackware/kdei[ru]=KDE Internationalization
+./slackware/kdei[sk]=KDE Internationalization
+./slackware/kdei[sv]=KDE Internationalization
+./slackware/kdei[tr]=KDE Internationalization
+./slackware/kdei[uk]=KDE Internationalization
+./slackware/kdei[vi]=KDE Internationalization
+./slackware/kdei[zh_CN]=KDE Internationalization
+./slackware/l=Libraries
+./slackware/l[bg]=Libraries
+./slackware/l[de]=Libraries
+./slackware/l[el]=Libraries
+./slackware/l[es]=Libraries
+./slackware/l[fr]=Libraries
+./slackware/l[gl_ES]=Libraries
+./slackware/l[id]=Libraries
+./slackware/l[it]=Libraries
+./slackware/l[ja]=Libraries
+./slackware/l[nl]=Libraries
+./slackware/l[pl]=Libraries
+./slackware/l[pt_BR]=Libraries
+./slackware/l[pt]=Libraries
+./slackware/l[ru]=Libraries
+./slackware/l[sk]=Libraries
+./slackware/l[sv]=Libraries
+./slackware/l[tr]=Libraries
+./slackware/l[uk]=Libraries
+./slackware/l[vi]=Libraries
+./slackware/l[zh_CN]=Libraries
+./slackware/n=Networking
+./slackware/n[bg]=Networking
+./slackware/n[de]=Networking
+./slackware/n[el]=Networking
+./slackware/n[es]=Networking
+./slackware/n[fr]=Networking
+./slackware/n[gl_ES]=Networking
+./slackware/n[id]=Networking
+./slackware/n[it]=Networking
+./slackware/n[ja]=Networking
+./slackware/n[nl]=Networking
+./slackware/n[pl]=Networking
+./slackware/n[pt_BR]=Networking
+./slackware/n[pt]=Networking
+./slackware/n[ru]=Networking
+./slackware/n[sk]=Networking
+./slackware/n[sv]=Networking
+./slackware/n[tr]=Networking
+./slackware/n[uk]=Networking
+./slackware/n[vi]=Networking
+./slackware/n[zh_CN]=Networking
+./slackware/t=teTeX
+./slackware/t[bg]=teTeX
+./slackware/t[de]=teTeX
+./slackware/t[el]=teTeX
+./slackware/t[es]=teTeX
+./slackware/t[fr]=teTeX
+./slackware/t[gl_ES]=teTeX
+./slackware/t[id]=teTeX
+./slackware/t[it]=teTeX
+./slackware/t[ja]=teTeX
+./slackware/t[nl]=teTeX
+./slackware/t[pl]=teTeX
+./slackware/t[pt_BR]=teTeX
+./slackware/t[pt]=teTeX
+./slackware/t[ru]=teTeX
+./slackware/t[sk]=teTeX
+./slackware/t[sv]=teTeX
+./slackware/t[tr]=teTeX
+./slackware/t[uk]=teTeX
+./slackware/t[vi]=teTeX
+./slackware/t[zh_CN]=teTeX
+./slackware/tcl=TCL
+./slackware/tcl[bg]=TCL
+./slackware/tcl[de]=TCL
+./slackware/tcl[el]=TCL
+./slackware/tcl[es]=TCL
+./slackware/tcl[fr]=TCL
+./slackware/tcl[gl_ES]=TCL
+./slackware/tcl[id]=TCL
+./slackware/tcl[it]=TCL
+./slackware/tcl[ja]=TCL
+./slackware/tcl[nl]=TCL
+./slackware/tcl[pl]=TCL
+./slackware/tcl[pt_BR]=TCL
+./slackware/tcl[pt]=TCL
+./slackware/tcl[ru]=TCL
+./slackware/tcl[sk]=TCL
+./slackware/tcl[sv]=TCL
+./slackware/tcl[tr]=TCL
+./slackware/tcl[uk]=TCL
+./slackware/tcl[vi]=TCL
+./slackware/tcl[zh_CN]=TCL
+./slackware/x=X Window System
+./slackware/x[bg]=X Window System
+./slackware/x[de]=X Window System
+./slackware/x[el]=X Window System
+./slackware/x[es]=X Window System
+./slackware/x[fr]=X Window System
+./slackware/x[gl_ES]=X Window System
+./slackware/x[id]=X Window System
+./slackware/x[it]=X Window System
+./slackware/x[ja]=X Window System
+./slackware/x[nl]=X Window System
+./slackware/x[pl]=X Window System
+./slackware/x[pt_BR]=X Window System
+./slackware/x[pt]=X Window System
+./slackware/x[ru]=X Window System
+./slackware/x[sk]=X Window System
+./slackware/x[sv]=X Window System
+./slackware/x[tr]=X Window System
+./slackware/x[uk]=X Window System
+./slackware/x[vi]=X Window System
+./slackware/x[zh_CN]=X Window System
+./slackware/xap=X Applications
+./slackware/xap[bg]=X Applications
+./slackware/xap[de]=X Applications
+./slackware/xap[el]=X Applications
+./slackware/xap[es]=X Applications
+./slackware/xap[fr]=X Applications
+./slackware/xap[gl_ES]=X Applications
+./slackware/xap[id]=X Applications
+./slackware/xap[it]=X Applications
+./slackware/xap[ja]=X Applications
+./slackware/xap[nl]=X Applications
+./slackware/xap[pl]=X Applications
+./slackware/xap[pt_BR]=X Applications
+./slackware/xap[pt]=X Applications
+./slackware/xap[ru]=X Applications
+./slackware/xap[sk]=X Applications
+./slackware/xap[sv]=X Applications
+./slackware/xap[tr]=X Applications
+./slackware/xap[uk]=X Applications
+./slackware/xap[vi]=X Applications
+./slackware/xap[zh_CN]=X Applications
+./slackware/y=BSD Console games
+./slackware/y[bg]=BSD Console games
+./slackware/y[de]=BSD Console games
+./slackware/y[el]=BSD Console games
+./slackware/y[es]=BSD Console games
+./slackware/y[fr]=BSD Console games
+./slackware/y[gl_ES]=BSD Console games
+./slackware/y[id]=BSD Console games
+./slackware/y[it]=BSD Console games
+./slackware/y[ja]=BSD Console games
+./slackware/y[nl]=BSD Console games
+./slackware/y[pl]=BSD Console games
+./slackware/y[pt_BR]=BSD Console games
+./slackware/y[pt]=BSD Console games
+./slackware/y[ru]=BSD Console games
+./slackware/y[sk]=BSD Console games
+./slackware/y[sv]=BSD Console games
+./slackware/y[tr]=BSD Console games
+./slackware/y[uk]=BSD Console games
+./slackware/y[vi]=BSD Console games
+./slackware/y[zh_CN]=BSD Console games
+./patches/packages=Patches
+./patches/packages[bg]=Patches
+./patches/packages[de]=Patches
+./patches/packages[el]=Patches
+./patches/packages[es]=Patches
+./patches/packages[fr]=Patches
+./patches/packages[gl_ES]=Patches
+./patches/packages[id]=Patches
+./patches/packages[it]=Patches
+./patches/packages[ja]=Patches
+./patches/packages[nl]=Patches
+./patches/packages[pl]=Patches
+./patches/packages[pt_BR]=Patches
+./patches/packages[pt]=Patches
+./patches/packages[ru]=Patches
+./patches/packages[sk]=Patches
+./patches/packages[sv]=Patches
+./patches/packages[tr]=Patches
+./patches/packages[uk]=Patches
+./patches/packages[vi]=Patches
+./patches/packages[zh_CN]=Patches
diff --git a/src/Makefile.am b/src/Makefile.am
index 99dedc0..e857ce4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ gslapt_SOURCES = \
support.c support.h \
interface.c interface.h \
callbacks.c callbacks.h \
+ series.c series.h \
settings.c settings.h
gslapt_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
diff --git a/src/callbacks.c b/src/callbacks.c
index 2d4d4bb..e58141a 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -28,9 +28,11 @@
#include "interface.h"
#include "support.h"
#include "settings.h"
+#include "series.h"
extern GtkWidget *gslapt;
extern GslaptSettings *gslapt_settings;
+extern GHashTable *gslapt_series_map;
extern slapt_rc_config *global_config;
extern struct slapt_pkg_list *all;
extern struct slapt_pkg_list *installed;
@@ -139,6 +141,7 @@ void on_gslapt_destroy (GtkObject *object, gpointer user_data)
slapt_free_pkg_list(all);
slapt_free_pkg_list(installed);
slapt_free_rc_config(global_config);
+ gslapt_series_map_free(gslapt_series_map);
gslapt_write_rc(gslapt_settings);
gslapt_free_rc(gslapt_settings);
@@ -511,9 +514,18 @@ void build_package_treeviewlist (GtkWidget *treeview)
base_model = GTK_TREE_MODEL(gtk_list_store_new (
NUMBER_OF_COLUMNS,
- GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN
+ GDK_TYPE_PIXBUF, /* status icon */
+ G_TYPE_STRING, /* name */
+ G_TYPE_STRING, /* version */
+ G_TYPE_STRING, /* location */
+ G_TYPE_STRING, /* series */
+ G_TYPE_STRING, /*desc */
+ G_TYPE_UINT, /* size */
+ G_TYPE_STRING, /* status */
+ G_TYPE_BOOLEAN, /* is installed */
+ G_TYPE_BOOLEAN, /* visible */
+ G_TYPE_BOOLEAN, /* marked */
+ G_TYPE_BOOLEAN /* is an upgrade */
));
for (i = 0; i < all->pkg_count; i++ ) {
@@ -524,7 +536,7 @@ void build_package_treeviewlist (GtkWidget *treeview)
GdkPixbuf *status_icon = NULL;
gchar *short_desc = slapt_gen_short_pkg_description(all->pkgs[i]);
slapt_pkg_info_t *installed_pkg = NULL, *newer_available_pkg = NULL;
- gchar *location = NULL;
+ gchar *location = NULL, *series = NULL;
installed_pkg = slapt_get_newest_pkg(installed,all->pkgs[i]->name);
if (installed_pkg != NULL) {
@@ -588,12 +600,15 @@ void build_package_treeviewlist (GtkWidget *treeview)
location = all->pkgs[i]->location;
}
+ series = gslapt_series_map_lookup(gslapt_series_map, location);
+
gtk_list_store_append(GTK_LIST_STORE(base_model), &iter);
gtk_list_store_set(GTK_LIST_STORE(base_model), &iter,
STATUS_ICON_COLUMN,status_icon,
NAME_COLUMN,all->pkgs[i]->name,
VERSION_COLUMN,all->pkgs[i]->version,
LOCATION_COLUMN,location,
+ SERIES_COLUMN,series,
DESC_COLUMN,short_desc,
SIZE_COLUMN,all->pkgs[i]->size_u,
STATUS_COLUMN,status,
@@ -638,6 +653,7 @@ void build_package_treeviewlist (GtkWidget *treeview)
NAME_COLUMN,installed->pkgs[i]->name,
VERSION_COLUMN,installed->pkgs[i]->version,
LOCATION_COLUMN,installed->pkgs[i]->location,
+ SERIES_COLUMN,installed->pkgs[i]->location,
DESC_COLUMN,short_desc,
SIZE_COLUMN,installed->pkgs[i]->size_u,
STATUS_COLUMN,status,
@@ -800,12 +816,11 @@ static void fillin_pkg_details (slapt_pkg_info_t *pkg)
slapt_pkg_info_t *latest_pkg = slapt_get_newest_pkg(all,pkg->name);
slapt_pkg_info_t *installed_pkg = slapt_get_newest_pkg(installed,pkg->name);
slapt_pkg_upgrade_t *pkg_upgrade = NULL;
- char *clean_desc = NULL, *changelog = NULL, *filelist = NULL;
+ char *clean_desc = NULL, *changelog = NULL, *filelist = NULL, *location = NULL;
const char *priority_str = NULL;
/* set package details */
gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_name")),pkg->name);
- gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_location")),pkg->location);
gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_version")),pkg->version);
gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_source")),pkg->mirror);
short_desc = slapt_gen_short_pkg_description(pkg);
@@ -815,6 +830,13 @@ static void fillin_pkg_details (slapt_pkg_info_t *pkg)
} else {
gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_description")),"");
}
+ location = gslapt_series_map_lookup(gslapt_series_map, pkg->location);
+ if (location != NULL) {
+ gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_location")),location);
+ free(location);
+ } else {
+ gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_location")),pkg->location);
+ }
priority_str = slapt_priority_to_str(pkg->priority);
gtk_label_set_text(GTK_LABEL(lookup_widget(gslapt,"pkg_info_priority")),priority_str);
@@ -2863,11 +2885,11 @@ void build_treeview_columns (GtkWidget *treeview)
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
gtk_tree_view_column_set_resizable(column, TRUE);
- /* column for location */
+ /* column for series */
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes ((gchar *)_("Location"), renderer,
- "text", LOCATION_COLUMN, NULL);
- gtk_tree_view_column_set_sort_column_id (column, LOCATION_COLUMN);
+ "text", SERIES_COLUMN, NULL);
+ gtk_tree_view_column_set_sort_column_id (column, SERIES_COLUMN);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
gtk_tree_view_column_set_resizable(column, TRUE);
diff --git a/src/callbacks.h b/src/callbacks.h
index 44a26b4..66005b4 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -25,6 +25,7 @@ enum {
NAME_COLUMN,
VERSION_COLUMN,
LOCATION_COLUMN,
+ SERIES_COLUMN,
DESC_COLUMN,
SIZE_COLUMN,
STATUS_COLUMN,
diff --git a/src/main.c b/src/main.c
index 8ba943f..8e824e2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,6 +25,7 @@
#include "interface.h"
#include "support.h"
#include "settings.h"
+#include "series.h"
slapt_rc_config *global_config; /* our config struct */
struct slapt_pkg_list *installed;
@@ -33,6 +34,7 @@ GtkWidget *gslapt;
slapt_transaction_t *trans = NULL;
char rc_location[1024];
GslaptSettings *gslapt_settings = NULL;
+GHashTable *gslapt_series_map = NULL;
int main (int argc, char *argv[]) {
GtkStatusbar *bar;
@@ -59,6 +61,10 @@ int main (int argc, char *argv[]) {
trans = slapt_init_transaction();
+ /* series name mapping */
+ gslapt_series_map = gslapt_series_map_init();
+ gslapt_series_map_fill(gslapt_series_map);
+
add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
for (option_index = 1; option_index < argc; ++option_index) {
diff --git a/src/series.c b/src/series.c
new file mode 100644
index 0000000..665989c
--- /dev/null
+++ b/src/series.c
@@ -0,0 +1,83 @@
+#include "series.h"
+
+GHashTable *gslapt_series_map_init(void)
+{
+ GHashTable *map = g_hash_table_new(g_str_hash, g_str_equal);
+
+ return map;
+}
+
+void gslapt_series_map_free(GHashTable *map)
+{
+ g_hash_table_destroy(map);
+}
+
+int gslapt_series_map_fill(GHashTable *map)
+{
+ char *file = NULL;
+ gchar **keys = NULL;
+ int c;
+
+ file = g_build_path (G_DIR_SEPARATOR_S, PACKAGE_DATA_DIR, PACKAGE, "series_map.rc", NULL);
+
+ if (file == NULL)
+ return -1;
+
+
+ if (g_file_test(file, G_FILE_TEST_IS_REGULAR) == TRUE) {
+ GKeyFile *keyfile= NULL;
+ GKeyFileFlags flags = G_KEY_FILE_NONE;
+ GError *error = NULL;
+
+ keyfile = g_key_file_new();
+ if (keyfile == NULL)
+ goto GSLAPT_SERIES_MAP_FILL_END;
+
+ if (!g_key_file_load_from_file (keyfile, file, flags, &error)) {
+ if (error != NULL)
+ g_error_free(error);
+ if (keyfile != NULL)
+ g_key_file_free(keyfile);
+ goto GSLAPT_SERIES_MAP_FILL_END;
+ }
+
+ keys = g_key_file_get_keys(keyfile, "series mappings", NULL, NULL);
+ if (keys != NULL) {
+ for (c = 0; keys[c] != NULL; c++) {
+ gchar *value = g_key_file_get_locale_string (keyfile, "series mappings", keys[c], NULL, NULL);
+ if (value != NULL) {
+ g_hash_table_insert(map, g_strdup(keys[c]), g_strdup(value));
+ g_free(value);
+ g_free(keys[c]);
+ }
+ }
+ g_free(keys);
+ }
+
+ g_key_file_free(keyfile);
+
+ }
+
+GSLAPT_SERIES_MAP_FILL_END:
+ free(file);
+
+ return 0;
+}
+
+char *gslapt_series_map_lookup(GHashTable *map, const char *key)
+{
+ char *value = NULL, *converted = NULL;
+ void *v = g_hash_table_lookup (map, key);
+ if (v != NULL) {
+ value = (char *)v;
+ } else {
+ value = g_path_get_basename(key);
+ }
+
+ converted = g_convert(value, strlen(value), "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+ if (converted != NULL)
+ value = converted;
+
+ return value;
+}
+
diff --git a/src/series.h b/src/series.h
new file mode 100644
index 0000000..7a48124
--- /dev/null
+++ b/src/series.h
@@ -0,0 +1,14 @@
+#ifndef GSLAPT_SERIES_HEADER
+#define GSLAPT_SERIES_HEADER
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include "config.h"
+
+GHashTable *gslapt_series_map_init(void);
+void gslapt_series_map_free(GHashTable *map);
+int gslapt_series_map_fill(GHashTable *map);
+char *gslapt_series_map_lookup(GHashTable *map, const char *key);
+
+#endif