diff options
-rw-r--r-- | includes/computer.h | 6 | ||||
-rw-r--r-- | includes/distro_flavors.h (renamed from includes/ubuntu_flavors.h) | 12 | ||||
-rw-r--r-- | modules/computer.c | 6 | ||||
-rw-r--r-- | modules/computer/os.c | 4 | ||||
-rw-r--r-- | modules/computer/ubuntu_flavors.c | 28 |
5 files changed, 31 insertions, 25 deletions
diff --git a/includes/computer.h b/includes/computer.h index d01e1f2f..25da8e27 100644 --- a/includes/computer.h +++ b/includes/computer.h @@ -90,7 +90,7 @@ struct _Computer { gchar *date_time; }; -#include "ubuntu_flavors.h" +#include "distro_flavors.h" struct _OperatingSystem { gchar *kernel; @@ -112,9 +112,7 @@ struct _OperatingSystem { gchar *entropy_avail; - /* perhaps this could union with a flavors/spins - * pointer for other distro families */ - const UbuntuFlavor* ubuntu_flavor; + const DistroFlavor* distro_flavor; }; struct _MemoryInfo { diff --git a/includes/ubuntu_flavors.h b/includes/distro_flavors.h index ea21ddb9..60c38531 100644 --- a/includes/ubuntu_flavors.h +++ b/includes/distro_flavors.h @@ -17,14 +17,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __UBUNTU_FLAVORS_H__ -#define __UBUNTU_FLAVORS_H__ +#ifndef __DISTRO_FLAVORS_H__ +#define __DISTRO_FLAVORS_H__ -typedef struct UbuntuFlavor { - const char *package; +typedef struct { const char *name; const char *icon; const char *url; +} DistroFlavor; + +typedef struct UbuntuFlavor { + const DistroFlavor base; + const char *package; } UbuntuFlavor; /* items are const; free with g_slist_free() */ diff --git a/modules/computer.c b/modules/computer.c index 95614ca7..faa4198e 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -566,10 +566,10 @@ gchar *callback_os(void) .icon = distro_icon), info_field_last()); - if (computer->os->ubuntu_flavor) { + if (computer->os->distro_flavor) { info_group_add_field(version_group, - info_field(_("Spin/Flavor"), computer->os->ubuntu_flavor->name, - .icon = computer->os->ubuntu_flavor->icon) ); + info_field(_("Spin/Flavor"), computer->os->distro_flavor->name, + .icon = computer->os->distro_flavor->icon) ); } info_add_group(info, _("Current Session"), diff --git a/modules/computer/os.c b/modules/computer/os.c index dae93761..ab557fa6 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -21,7 +21,7 @@ #include <sys/utsname.h> #include "hardinfo.h" #include "computer.h" -#include "ubuntu_flavors.h" +#include "distro_flavors.h" static gchar * get_libc_version(void) @@ -536,7 +536,7 @@ computer_get_os(void) GSList *flavs = ubuntu_flavors_scan(); if (flavs) { /* just use the first one */ - os->ubuntu_flavor = (UbuntuFlavor*)flavs->data; + os->distro_flavor = (DistroFlavor*)flavs->data; } g_slist_free(flavs); } diff --git a/modules/computer/ubuntu_flavors.c b/modules/computer/ubuntu_flavors.c index 9bc32d74..84fa147f 100644 --- a/modules/computer/ubuntu_flavors.c +++ b/modules/computer/ubuntu_flavors.c @@ -18,27 +18,31 @@ */ #include <hardinfo.h> -#include "ubuntu_flavors.h" +#include "distro_flavors.h" #include "dt_util.h" /* for appf() */ #define SEQ(s,m) (g_strcmp0(s, m) == 0) static const UbuntuFlavor ubuntu_flavors[] = { - { "ubuntu-server", "Vanilla Server", "distros/ubuntu.png", "https://ubuntu.org/" }, - { "ubuntu-desktop", "Ubuntu GNOME", "distros/ubuntu.png", "https://ubuntu.org/" }, - { "xubuntu-desktop", "Xubuntu", "distros/xubuntu.svg", "https://xubuntu.org/" }, - { "kubuntu-desktop", "Kubuntu", "distros/kubuntu.png", "https://kubuntu.org/" }, - { "lubuntu-desktop", "Lubuntu", "distros/lubuntu.png", "https://lubuntu.me/" }, /* formerly or also lubuntu.net? */ - { "ubuntu-mate-desktop", "Ubuntu MATE", "distros/ubuntu-mate.png", "https://ubuntu-mate.org/" }, - { "ubuntu-budgie-desktop", "Ubuntu Budgie", "distros/ubuntu-budgie.png", "https://ubuntubudgie.org/" }, - { "ubuntukylin-desktop", "UbuntuKylin (做最有中国味的操作系统)", "distros/ubuntu-kylin.png", "https://www.ubuntukylin.com" }, - { "ubuntustudio-desktop", "UbuntuStudio", "distros/ubuntu-studio.png", "https://ubuntustudio.org/"}, + { "Vanilla Server", "distros/ubuntu.png", "https://ubuntu.org", "ubuntu-server" }, + { "Vanilla Desktop", "distros/ubuntu.png", "https://ubuntu.org", "ubuntu-desktop" }, + { "Xubuntu", "distros/xubuntu.svg", "https://xubuntu.org", "xubuntu-desktop" }, + { "Kubuntu", "distros/kubuntu.png", "https://kubuntu.org", "kubuntu-desktop" }, + { "Lubuntu", "distros/lubuntu.png", "https://lubuntu.me", "lubuntu-desktop" }, /* formerly or also lubuntu.net? */ + { "Ubuntu MATE", "distros/ubuntu-mate.png", "https://ubuntu-mate.org", "ubuntu-mate-desktop" }, + { "Ubuntu Budgie", "distros/ubuntu-budgie.png", "https://ubuntubudgie.org", "ubuntu-budgie-desktop" }, + { "UbuntuKylin (做最有中国味的操作系统)", "distros/ubuntu-kylin.png", "https://www.ubuntukylin.com", "ubuntukylin-desktop" }, + { "UbuntuStudio", "distros/ubuntu-studio.png", "https://ubuntustudio.org", "ubuntustudio-desktop" }, + /* Deprecated flavors */ + { "Ubuntu GNOME", "distros/ubuntu-gnome.png", "https://ubuntugnome.org", "ubuntu-gnome-desktop" }, + // Edubuntu + // Mythbuntu { NULL } }; static const UbuntuFlavor *_find_flavor(const gchar *pkg) { int i = 0; - for(; ubuntu_flavors[i].name; i++) { + for(; ubuntu_flavors[i].base.name; i++) { if (SEQ(ubuntu_flavors[i].package, pkg)) return &ubuntu_flavors[i]; } @@ -54,7 +58,7 @@ GSList *ubuntu_flavors_scan(void) { const UbuntuFlavor *f = NULL; gchar *cmd_line = g_strdup("apt-cache policy"); int i; - for(i = 0; ubuntu_flavors[i].name; i++) { + for(i = 0; ubuntu_flavors[i].base.name; i++) { cmd_line = appf(cmd_line, "%s", ubuntu_flavors[i].package); } if (!i) |