aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-sort-info.c
blob: bf90a1360257b8f7c975c15e74727ef35b73b50d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * e-table-sort-info.c: a Table Model
 *
 * Author:
 *   Miguel de Icaza (miguel@gnu.org)
 *
 * (C) 1999 Helix Code, Inc.
 */
#include <config.h>
#include <gtk/gtksignal.h>
#include <gnome-xml/tree.h>
#include "e-table-sort-info.h"
#include "e-util/e-util.h"

#define ETM_CLASS(e) ((ETableSortInfoClass *)((GtkObject *)e)->klass)

#define PARENT_TYPE gtk_object_get_type ()
                      

static GtkObjectClass *e_table_sort_info_parent_class;

enum {
    SORT_INFO_CHANGED,
    LAST_SIGNAL
};

static guint e_table_sort_info_signals [LAST_SIGNAL] = { 0, };

enum {
    ARG_0,
    ARG_GROUPING
};

static void
etsi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
    ETableSortInfo *etsi;

    etsi = E_TABLE_SORT_INFO (o);

    switch (arg_id){
    case ARG_GROUPING:
        etsi->grouping = GTK_VALUE_POINTER (*arg);
        break;
    }
}

static void
etsi_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
    ETableSortInfo *etsi;

    etsi = E_TABLE_SORT_INFO (o);

    switch (arg_id){
    case ARG_GROUPING:
        GTK_VALUE_POINTER (*arg) = etsi->grouping;
        break;
    }
}

static void
e_table_sort_info_class_init (GtkObjectClass *object_class)
{
    e_table_sort_info_parent_class = gtk_type_class (gtk_object_get_type ());
    
    object_class->set_arg = etsi_set_arg;
    object_class->get_arg = etsi_get_arg;

    e_table_sort_info_signals [SORT_INFO_CHANGED] =
        gtk_signal_new ("sort_info_changed",
                GTK_RUN_LAST,
                object_class->type,
                GTK_SIGNAL_OFFSET (ETableSortInfoClass, sort_info_changed),
                gtk_marshal_NONE__NONE,
                GTK_TYPE_NONE, 0);

    gtk_object_class_add_signals (object_class, e_table_sort_info_signals, LAST_SIGNAL);

    gtk_object_add_arg_type ("ETableSortInfo::grouping", GTK_TYPE_POINTER,
                 GTK_ARG_READWRITE, ARG_GROUPING);
}

E_MAKE_TYPE(e_table_sort_info, "ETableSortInfo", ETableSortInfo,
        e_table_sort_info_class_init, NULL, PARENT_TYPE);

void
e_table_sort_info_changed (ETableSortInfo *e_table_sort_info)
{
    g_return_if_fail (e_table_sort_info != NULL);
    g_return_if_fail (E_IS_TABLE_SORT_INFO (e_table_sort_info));
    
    gtk_signal_emit (GTK_OBJECT (e_table_sort_info),
             e_table_sort_info_signals [SORT_INFO_CHANGED]);
}

ETableSortInfo *
e_table_sort_info_new (void)
{
    return gtk_type_new (e_table_sort_info_get_type ());
}