source: trunk/third/gnome-core/panel/distribution.c @ 15821

Revision 15821, 2.6 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15820, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * GNOME panel linux distribution module.
3 * (C) 2000 The Free Software Foundation
4 *
5 * Authors: Martin Baulig <baulig@suse.de>
6 */
7
8#include <config.h>
9#include <gnome.h>
10
11#include "panel-include.h"
12
13/* Note for distribution vendors:
14 *
15 * This file - especially the `distribution_info' array - is
16 * the only place which you need to custumize in order to make
17 * the `Distribution' menu in the panel working.
18 *
19 */
20
21static void rh_menu_init_func (void);
22static void rh_menu_show_func (GtkWidget *, GtkMenuItem *);
23
24static DistributionInfo distribution_info [] = {
25        { DISTRIBUTION_DEBIAN, "/etc/debian_version",
26          N_("Debian GNU/Linux"), N_("Debian menus"),
27          "gnome-debian.png", "/var/lib/gnome/Debian/.",
28          NULL, NULL
29        },
30        { DISTRIBUTION_REDHAT, "/etc/redhat-release",
31          N_("Red Hat Linux"), N_("Red Hat menus"), NULL,
32          "apps-redhat",
33          rh_menu_init_func, rh_menu_show_func
34        },
35        { DISTRIBUTION_SUSE, "/etc/SuSE-release",
36          N_("SuSE Linux"), N_("SuSE menus"), "gnome-suse.png",
37          GNOME_DATADIR "/gnome/distribution-menus/SuSE/.",
38          NULL, NULL
39        },
40        { DISTRIBUTION_UNKNOWN, NULL, NULL, NULL, NULL }
41};
42
43static DistributionType
44internal_get_distribution_type (void)
45{
46        DistributionInfo *ptr;
47
48        for (ptr = distribution_info; ptr->type != DISTRIBUTION_UNKNOWN; ptr++)
49                if (panel_file_exists (ptr->version_file))
50                        return ptr->type;
51
52        return DISTRIBUTION_UNKNOWN;
53}
54
55static const DistributionInfo *
56internal_get_distribution_info (DistributionType type)
57{
58        DistributionInfo *ptr;
59
60        for (ptr = distribution_info; ptr->type != DISTRIBUTION_UNKNOWN; ptr++)
61                if (ptr->type == type)
62                        return ptr;
63
64        return NULL;
65}
66
67/* note that this function is marked G_GNUC_CONST in distribution.h */
68DistributionType
69get_distribution_type (void)
70{
71        static gboolean cached = FALSE;
72        static DistributionType cache = DISTRIBUTION_UNKNOWN;
73
74        if (cached) {
75                return cache;
76        }
77
78        cache = internal_get_distribution_type ();
79        cached = TRUE;
80
81        return cache;
82}
83
84/* note that this function is marked G_GNUC_CONST in distribution.h */
85const DistributionInfo *
86get_distribution_info (void)
87{
88        static gboolean cached = FALSE;
89        static const DistributionInfo *cache = NULL;
90        DistributionType type;
91
92        if (cached) {
93                return cache;
94        }
95
96        type = get_distribution_type ();
97
98        cache = internal_get_distribution_info (type);
99        cached = TRUE;
100
101        return cache;
102}
103
104/*
105 * Distribution specific menu functions.
106 */
107
108static void
109rh_menu_init_func (void)
110{
111        /* Use the fork version to create the Red Hat menus. */
112        create_rh_menu (TRUE);
113}
114
115static void
116rh_menu_show_func (GtkWidget *menuw, GtkMenuItem *menuitem)
117{
118        rh_submenu_to_display (menuw, menuitem);
119}
120
Note: See TracBrowser for help on using the repository browser.