source: trunk/third/gnome-vfs/libgnomevfs/gnome-vfs-mime-monitor.c @ 17128

Revision 17128, 3.3 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17127, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
2
3   gnome-vfs-mime-monitor.c: Class for noticing changes in MIME data.
4 
5   Copyright (C) 2000 Eazel, Inc.
6 
7   This program is free software; you can redistribute it and/or
8   modify it under the terms of the GNU General Public License as
9   published by the Free Software Foundation; either version 2 of the
10   License, or (at your option) any later version.
11 
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   General Public License for more details.
16 
17   You should have received a copy of the GNU General Public
18   License along with this program; if not, write to the
19   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20   Boston, MA 02111-1307, USA.
21 
22   Authors: John Sullivan <sullivan@eazel.com>,
23*/
24
25#include <config.h>
26#include "gnome-vfs-mime-monitor.h"
27
28#include "gnome-vfs-mime-private.h"
29
30#include <gtk/gtksignal.h>
31
32#define GNOME_VFS_MIME_MONITOR(obj) \
33        GTK_CHECK_CAST (obj, gnome_vfs_mime_monitor_get_type (), GnomeVFSMIMEMonitor)
34
35typedef struct {
36        GtkObjectClass parent_class;
37} GnomeVFSMIMEMonitorClass;
38
39enum {
40        DATA_CHANGED,
41        LAST_SIGNAL
42};
43static guint signals[LAST_SIGNAL];
44
45static GtkType    gnome_vfs_mime_monitor_get_type         (void);
46static void       gnome_vfs_mime_monitor_initialize_class (GnomeVFSMIMEMonitorClass *class);
47static void       gnome_vfs_mime_monitor_initialize       (GnomeVFSMIMEMonitor      *monitor);
48
49static gpointer parent_class;
50
51static GtkType
52gnome_vfs_mime_monitor_get_type (void)
53{
54        GtkType parent_type;
55        static GtkType type;
56
57        if (type == 0) {
58                static GtkTypeInfo info = {
59                        "GnomeVFSMIMEMonitor",
60                        sizeof (GnomeVFSMIMEMonitor),
61                        sizeof (GnomeVFSMIMEMonitorClass),
62                        (GtkClassInitFunc)gnome_vfs_mime_monitor_initialize_class,
63                        (GtkObjectInitFunc)gnome_vfs_mime_monitor_initialize,
64                        NULL,
65                        NULL,
66                        NULL
67                };
68
69                parent_type = GTK_TYPE_OBJECT;
70                type = gtk_type_unique (parent_type, &info);
71                parent_class = gtk_type_class (parent_type);
72        }
73
74        return type;
75}
76
77static GnomeVFSMIMEMonitor *global_mime_monitor = NULL;
78
79/* Return a pointer to the single global monitor. */
80GnomeVFSMIMEMonitor *
81gnome_vfs_mime_monitor_get (void)
82{
83        if (global_mime_monitor == NULL) {
84                global_mime_monitor = GNOME_VFS_MIME_MONITOR
85                        (gtk_object_new (gnome_vfs_mime_monitor_get_type (), NULL));
86        }
87        return global_mime_monitor;
88}
89
90static void
91gnome_vfs_mime_monitor_initialize (GnomeVFSMIMEMonitor *monitor)
92{
93}
94
95static void
96gnome_vfs_mime_monitor_initialize_class (GnomeVFSMIMEMonitorClass *class)
97{
98        GtkObjectClass *object_class;
99
100        object_class = GTK_OBJECT_CLASS (class);
101
102        signals[DATA_CHANGED]
103                = gtk_signal_new ("data_changed",
104                                  GTK_RUN_LAST,
105#if GNOME_PLATFORM_VERSION < 1095000
106                                  object_class->type,
107#else
108                                  G_OBJECT_CLASS_TYPE (G_OBJECT (object_class)),
109#endif
110                                  0,
111                                  gtk_marshal_NONE__NONE,
112                                  GTK_TYPE_NONE, 0);
113
114#if GNOME_PLATFORM_VERSION < 1095000
115        gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
116#endif
117}
118
119void
120gnome_vfs_mime_monitor_emit_data_changed (GnomeVFSMIMEMonitor *monitor)
121{
122        gtk_signal_emit (GTK_OBJECT (monitor),
123                         signals[DATA_CHANGED]);       
124}
Note: See TracBrowser for help on using the repository browser.