source: trunk/third/libgnomeprintui/libgnomeprintui/gnome-print-widget.c @ 20964

Revision 20964, 3.4 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20963, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 *  gnome-print-widget.c: Configuration widgets for GnomePrintConfig options
4 *
5 *  This program is free software; you can redistribute it and/or
6 *  modify it under the terms of the GNU Library General Public License
7 *  as published by the Free Software Foundation; either version 2 of
8 *  the License, or (at your option) any later version.
9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU Library General Public License for more details.
14 *
15 *  You should have received a copy of the GNU Library General Public
16 *  License along with this program; if not, write to the Free Software
17 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 *  Authors:
20 *    Chema Celorio <chema@ximian.com>
21 *
22 *  Copyright 2003 Ximian, Inc.
23 */
24
25#define GNOME_PRINT_UNSTABLE_API
26
27#include <config.h>
28
29#include <gtk/gtk.h>
30#include <libgnomeprint/private/gpa-node-private.h>
31#include <libgnomeprint/gnome-print-config.h>
32#include <libgnomeprint/private/gnome-print-config-private.h>
33
34#include "gnome-print-widget.h"
35#include <libgnomeprintui/gpaui/gpa-checkbutton.h>
36#include <libgnomeprintui/gpaui/gpa-radiobutton.h>
37
38GtkWidget *
39gnome_print_radiobutton_new (GnomePrintConfig *config, const guchar *path, GnomePrintConfigOption *options)
40{
41        GtkWidget *widget;
42        GPANode *node;
43        GPANode *gpa_config;
44           
45        g_return_val_if_fail (config, NULL);
46        g_return_val_if_fail (GNOME_IS_PRINT_CONFIG (config), NULL);
47        g_return_val_if_fail (path, NULL);
48
49        gpa_config = gnome_print_config_get_node (config);
50        node = gpa_node_lookup (gpa_config, path);
51        if (!node) {
52                g_warning ("Could not find \"%s\" node inside gnome_print_widget_new", path);
53                return NULL;
54        }
55        gpa_node_unref (node);
56       
57        widget = gpa_radiobutton_new (config, path, (GPAApplicationOption *) options);
58
59        return widget;
60}
61
62GtkWidget *
63gnome_print_checkbutton_new (GnomePrintConfig *config, const guchar *path, const guchar *label)
64{
65        GtkWidget *widget;
66        GPANode *node;
67        GPANode *gpa_config;
68           
69        g_return_val_if_fail (config, NULL);
70        g_return_val_if_fail (GNOME_IS_PRINT_CONFIG (config), NULL);
71        g_return_val_if_fail (path, NULL);
72
73        gpa_config = gnome_print_config_get_node (config);
74        node = gpa_node_lookup (gpa_config, path);
75        if (!node) {
76                g_warning ("Could not find \"%s\" node inside gnome_print_widget_new", path);
77                return NULL;
78        }
79        gpa_node_unref (node);
80       
81        widget = gpa_checkbutton_new (config, path, label);
82
83        return widget;
84}
85
86GtkWidget *
87gnome_print_widget_new (GnomePrintConfig *config, const guchar *path, GnomePrintWidgetType type)
88{
89        GtkWidget *widget;
90        GPANode *gpa_config;
91        GPANode *node;
92       
93        g_return_val_if_fail (config, NULL);
94        g_return_val_if_fail (GNOME_IS_PRINT_CONFIG (config), NULL);
95        g_return_val_if_fail (path, NULL);
96
97        gpa_config = gnome_print_config_get_node (config);
98        node = gpa_node_lookup (gpa_config, path);
99        if (!node) {
100                   g_warning ("Could not find \"%s\" node inside gnome_print_widget_new", path);
101                   return NULL;
102        }
103        gpa_node_unref (node);
104
105        switch (type) {
106        case GNOME_PRINT_WIDGET_CHECKBUTTON:
107                widget = gpa_checkbutton_new (config, path, "Some label here");
108                break;
109        default:
110                widget = gtk_check_button_new_with_mnemonic ("_Invalid GnomePrintWidget type");
111                break;
112        }
113
114        gtk_widget_show_all (widget);
115       
116        return widget;
117}
Note: See TracBrowser for help on using the repository browser.