From bb0d974f967a62a6ff594b56940f7c11d3d1132c Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 28 Oct 2002 22:50:05 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'EVOLUTION_1_1_90'. svn path=/tags/EVOLUTION_1_1_90/; revision=18466 --- widgets/menus/gal-define-views-dialog.c | 354 --------- widgets/menus/gal-define-views-dialog.h | 78 -- widgets/menus/gal-define-views-model.c | 335 -------- widgets/menus/gal-define-views-model.h | 72 -- widgets/menus/gal-define-views.glade | 311 -------- widgets/menus/gal-view-collection.c | 838 --------------------- widgets/menus/gal-view-collection.h | 152 ---- widgets/menus/gal-view-etable.c | 321 -------- widgets/menus/gal-view-etable.h | 78 -- widgets/menus/gal-view-factory-etable.c | 143 ---- widgets/menus/gal-view-factory-etable.h | 61 -- widgets/menus/gal-view-factory.c | 126 ---- widgets/menus/gal-view-factory.h | 78 -- widgets/menus/gal-view-instance-save-as-dialog.c | 312 -------- .../menus/gal-view-instance-save-as-dialog.glade | 269 ------- widgets/menus/gal-view-instance-save-as-dialog.h | 89 --- widgets/menus/gal-view-instance.c | 620 --------------- widgets/menus/gal-view-instance.h | 119 --- widgets/menus/gal-view-new-dialog.c | 224 ------ widgets/menus/gal-view-new-dialog.glade | 220 ------ widgets/menus/gal-view-new-dialog.h | 79 -- widgets/menus/gal-view.c | 225 ------ widgets/menus/gal-view.h | 96 --- 23 files changed, 5200 deletions(-) delete mode 100644 widgets/menus/gal-define-views-dialog.c delete mode 100644 widgets/menus/gal-define-views-dialog.h delete mode 100644 widgets/menus/gal-define-views-model.c delete mode 100644 widgets/menus/gal-define-views-model.h delete mode 100644 widgets/menus/gal-define-views.glade delete mode 100644 widgets/menus/gal-view-collection.c delete mode 100644 widgets/menus/gal-view-collection.h delete mode 100644 widgets/menus/gal-view-etable.c delete mode 100644 widgets/menus/gal-view-etable.h delete mode 100644 widgets/menus/gal-view-factory-etable.c delete mode 100644 widgets/menus/gal-view-factory-etable.h delete mode 100644 widgets/menus/gal-view-factory.c delete mode 100644 widgets/menus/gal-view-factory.h delete mode 100644 widgets/menus/gal-view-instance-save-as-dialog.c delete mode 100644 widgets/menus/gal-view-instance-save-as-dialog.glade delete mode 100644 widgets/menus/gal-view-instance-save-as-dialog.h delete mode 100644 widgets/menus/gal-view-instance.c delete mode 100644 widgets/menus/gal-view-instance.h delete mode 100644 widgets/menus/gal-view-new-dialog.c delete mode 100644 widgets/menus/gal-view-new-dialog.glade delete mode 100644 widgets/menus/gal-view-new-dialog.h delete mode 100644 widgets/menus/gal-view.c delete mode 100644 widgets/menus/gal-view.h (limited to 'widgets/menus') diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c deleted file mode 100644 index d692077d45..0000000000 --- a/widgets/menus/gal-define-views-dialog.c +++ /dev/null @@ -1,354 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-dialog.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "gal-define-views-dialog.h" - -#include -#include -#include "gal-define-views-model.h" -#include "gal-view-new-dialog.h" -#include -#include - -static void gal_define_views_dialog_init (GalDefineViewsDialog *card); -static void gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass); -static void gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gal_define_views_dialog_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, - ARG_COLLECTION -}; - -typedef struct { - char *title; - ETableModel *model; - GalDefineViewsDialog *names; -} GalDefineViewsDialogChild; - -GtkType -gal_define_views_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "GalDefineViewsDialog", - sizeof (GalDefineViewsDialog), - sizeof (GalDefineViewsDialogClass), - (GtkClassInitFunc) gal_define_views_dialog_class_init, - (GtkObjectInitFunc) gal_define_views_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = gal_define_views_dialog_set_arg; - object_class->get_arg = gal_define_views_dialog_get_arg; - object_class->destroy = gal_define_views_dialog_destroy; - - gtk_object_add_arg_type("GalDefineViewsDialog::collection", GAL_VIEW_COLLECTION_TYPE, - GTK_ARG_READWRITE, ARG_COLLECTION); -} - -/* ETable creation */ -#define SPEC "" \ - "" \ - " " \ - "" - -/* For use from libglade. */ -GtkWidget *gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2) -{ - GtkWidget *table; - ETableModel *model; - model = gal_define_views_model_new(); - table = e_table_scrolled_new(model, NULL, SPEC, NULL); - gtk_object_set_data(GTK_OBJECT(table), "GalDefineViewsDialog::model", model); - return table; -} - -/* Button callbacks */ - -static void -gdvd_button_new_dialog_callback(GtkWidget *widget, int button, GalDefineViewsDialog *dialog) -{ - gchar *name; - GalView *view; - GalViewFactory *factory; - switch (button) { - case 0: - gtk_object_get(GTK_OBJECT(widget), - "name", &name, - "factory", &factory, - NULL); - if (name && factory) { - view = gal_view_factory_new_view(factory, - name); - gal_define_views_model_append(GAL_DEFINE_VIEWS_MODEL(dialog->model), view); - gal_view_edit(view); - gtk_object_unref(GTK_OBJECT(view)); - } - break; - } - gnome_dialog_close(GNOME_DIALOG(widget)); -} - -static void -gdvd_button_new_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - GtkWidget *view_new_dialog = gal_view_new_dialog_new(dialog->collection); - gtk_signal_connect(GTK_OBJECT(view_new_dialog), "clicked", - GTK_SIGNAL_FUNC(gdvd_button_new_dialog_callback), dialog); - gtk_widget_show(GTK_WIDGET(view_new_dialog)); -} - -static void -gdvd_button_modify_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - GalView *view; - view = gal_define_views_model_get_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - gal_view_edit(view); - } - -} - -static void -gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - gal_define_views_model_delete_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - } - -} - -static void -gdvd_button_copy_callback(GtkWidget *widget, GalDefineViewsDialog *dialog) -{ - int row; - GtkWidget *scrolled; - ETable *etable; - - scrolled = glade_xml_get_widget(dialog->gui, "custom-table"); - etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled)); - row = e_table_get_cursor_row (E_TABLE(etable)); - - if (row != -1) { - gal_define_views_model_copy_view(GAL_DEFINE_VIEWS_MODEL(dialog->model), - row); - } - -} - -static void -gdvd_connect_signal(GalDefineViewsDialog *dialog, char *widget_name, char *signal, GtkSignalFunc handler) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget(dialog->gui, widget_name); - - if (widget) - gtk_signal_connect(GTK_OBJECT(widget), signal, handler, dialog); -} - -static void -gal_define_views_dialog_init (GalDefineViewsDialog *dialog) -{ - GladeXML *gui; - GtkWidget *widget; - GtkWidget *etable; - - dialog->collection = NULL; - - gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-define-views.glade", NULL, E_I18N_DOMAIN); - dialog->gui = gui; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_widget_unparent(widget); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gdvd_connect_signal(dialog, "button-new", "clicked", GTK_SIGNAL_FUNC(gdvd_button_new_callback)); - gdvd_connect_signal(dialog, "button-modify", "clicked", GTK_SIGNAL_FUNC(gdvd_button_modify_callback)); - gdvd_connect_signal(dialog, "button-delete", "clicked", GTK_SIGNAL_FUNC(gdvd_button_delete_callback)); - gdvd_connect_signal(dialog, "button-copy", "clicked", GTK_SIGNAL_FUNC(gdvd_button_copy_callback)); - - dialog->model = NULL; - etable = glade_xml_get_widget(dialog->gui, "custom-table"); - if (etable) { - dialog->model = gtk_object_get_data(GTK_OBJECT(etable), "GalDefineViewsDialog::model"); - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", dialog->collection, - NULL); - } - - gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); -} - -static void -gal_define_views_dialog_destroy (GtkObject *object) -{ - GalDefineViewsDialog *gal_define_views_dialog = GAL_DEFINE_VIEWS_DIALOG(object); - - gtk_object_unref(GTK_OBJECT(gal_define_views_dialog->gui)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -gal_define_views_dialog_set_collection(GalDefineViewsDialog *dialog, - GalViewCollection *collection) -{ - dialog->collection = collection; - if (dialog->model) { - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", collection, - NULL); - } - if (dialog->gui) { - GtkWidget *widget = glade_xml_get_widget(dialog->gui, "label-views"); - if (widget && GTK_IS_LABEL (widget)) { - if (collection->title) { - char *text = g_strdup_printf (_("Define Views for %s"), - collection->title); - gtk_label_set_text (GTK_LABEL (widget), - text); - g_free (text); - } else { - gtk_label_set_text (GTK_LABEL (widget), - _("Define Views")); - } - } - } -} - -/** - * gal_define_views_dialog_new - * - * Returns a new dialog for defining views. - * - * Returns: The GalDefineViewsDialog. - */ -GtkWidget* -gal_define_views_dialog_new (GalViewCollection *collection) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (gal_define_views_dialog_get_type ())); - gal_define_views_dialog_set_collection(GAL_DEFINE_VIEWS_DIALOG (widget), collection); - return widget; -} - -static void -gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalDefineViewsDialog *dialog; - - dialog = GAL_DEFINE_VIEWS_DIALOG (o); - - switch (arg_id){ - case ARG_COLLECTION: - if (GTK_VALUE_OBJECT(*arg)) - gal_define_views_dialog_set_collection(dialog, GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT(*arg))); - else - gal_define_views_dialog_set_collection(dialog, NULL); - break; - - default: - return; - } -} - -static void -gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalDefineViewsDialog *dialog; - - dialog = GAL_DEFINE_VIEWS_DIALOG (object); - - switch (arg_id) { - case ARG_COLLECTION: - if (dialog->collection) - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(dialog->collection); - else - GTK_VALUE_OBJECT(*arg) = NULL; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/widgets/menus/gal-define-views-dialog.h b/widgets/menus/gal-define-views-dialog.h deleted file mode 100644 index edd40ed7c5..0000000000 --- a/widgets/menus/gal-define-views-dialog.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-dialog.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GAL_DEFINE_VIEWS_DIALOG_H__ -#define __GAL_DEFINE_VIEWS_DIALOG_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* GalDefineViewsDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define GAL_DEFINE_VIEWS_DIALOG_TYPE (gal_define_views_dialog_get_type ()) -#define GAL_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialog)) -#define GAL_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialogClass)) -#define GAL_IS_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE)) -#define GAL_IS_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE)) - -typedef struct _GalDefineViewsDialog GalDefineViewsDialog; -typedef struct _GalDefineViewsDialogClass GalDefineViewsDialogClass; - -struct _GalDefineViewsDialog -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - ETableModel *model; - - GalViewCollection *collection; -}; - -struct _GalDefineViewsDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkWidget *gal_define_views_dialog_new (GalViewCollection *collection); -GtkType gal_define_views_dialog_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_DEFINE_VIEWS_DIALOG_H__ */ diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c deleted file mode 100644 index ca54e19c8d..0000000000 --- a/widgets/menus/gal-define-views-model.c +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-model.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include -#include -#include -#include "gal-define-views-model.h" - -#define PARENT_TYPE e_table_model_get_type() -static ETableModelClass *parent_class; - -/* - * GalDefineViewsModel callbacks - * These are the callbacks that define the behavior of our custom model. - */ -static void gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - - -enum { - ARG_0, - ARG_EDITABLE, - ARG_COLLECTION -}; - -static void -gdvm_destroy(GtkObject *object) -{ - GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - - gtk_object_unref(GTK_OBJECT(model->collection)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -gdvm_col_count (ETableModel *etc) -{ - return 1; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -gdvm_row_count (ETableModel *etc) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - if (views->collection) - return gal_view_collection_get_count(views->collection); - else - return 0; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -gdvm_value_at (ETableModel *etc, int col, int row) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - const char *value; - - value = gal_view_get_title (gal_view_collection_get_view(views->collection, row)); - - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -gdvm_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc); - if (views->editable) { - e_table_model_pre_change(etc); - gal_view_set_title(gal_view_collection_get_view(views->collection, row), val); - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -gdvm_is_cell_editable (ETableModel *etc, int col, int row) -{ - return GAL_DEFINE_VIEWS_MODEL(etc)->editable; -} - -static void -gdvm_append_row (ETableModel *etm, ETableModel *source, gint row) -{ -} - -/* This function duplicates the value passed to it. */ -static void * -gdvm_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -gdvm_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -gdvm_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -gdvm_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -gdvm_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/** - * gal_define_views_model_append - * @model: The model to add to. - * @view: The view to add. - * - * Adds the given view to the gal define views model. - */ -void -gal_define_views_model_append (GalDefineViewsModel *model, - GalView *view) -{ - ETableModel *etm = E_TABLE_MODEL(model); - - e_table_model_pre_change(etm); - gal_view_collection_append(model->collection, view); - e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1); -} - -static void -gal_define_views_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = gdvm_destroy; - object_class->set_arg = gal_define_views_model_set_arg; - object_class->get_arg = gal_define_views_model_get_arg; - - gtk_object_add_arg_type ("GalDefineViewsModel::editable", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("GalDefineViewsModel::collection", GAL_VIEW_COLLECTION_TYPE, - GTK_ARG_READWRITE, ARG_COLLECTION); - - model_class->column_count = gdvm_col_count; - model_class->row_count = gdvm_row_count; - model_class->value_at = gdvm_value_at; - model_class->set_value_at = gdvm_set_value_at; - model_class->is_cell_editable = gdvm_is_cell_editable; - model_class->append_row = gdvm_append_row; - model_class->duplicate_value = gdvm_duplicate_value; - model_class->free_value = gdvm_free_value; - model_class->initialize_value = gdvm_initialize_value; - model_class->value_is_empty = gdvm_value_is_empty; - model_class->value_to_string = gdvm_value_to_string; -} - -static void -gal_define_views_model_init (GtkObject *object) -{ - GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - - model->collection = NULL; -} - -static void -gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalDefineViewsModel *model; - - model = GAL_DEFINE_VIEWS_MODEL (o); - - switch (arg_id){ - case ARG_EDITABLE: - model->editable = GTK_VALUE_BOOL (*arg); - break; - - case ARG_COLLECTION: - e_table_model_pre_change(E_TABLE_MODEL(o)); - if (GTK_VALUE_OBJECT (*arg)) - model->collection = GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT (*arg)); - else - model->collection = NULL; - e_table_model_changed(E_TABLE_MODEL(o)); - break; - } -} - -static void -gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalDefineViewsModel *model; - - model = GAL_DEFINE_VIEWS_MODEL (object); - - switch (arg_id) { - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = model->editable; - break; - - case ARG_COLLECTION: - if (model->collection) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(model->collection); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -GtkType -gal_define_views_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "GalDefineViewsModel", - sizeof (GalDefineViewsModel), - sizeof (GalDefineViewsModelClass), - (GtkClassInitFunc) gal_define_views_model_class_init, - (GtkObjectInitFunc) gal_define_views_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * gal_define_views_model_new - * - * Returns a new define views model. This is a list of views as an - * ETable for use in the GalDefineViewsDialog. - * - * Returns: The new GalDefineViewsModel. - */ -ETableModel * -gal_define_views_model_new (void) -{ - GalDefineViewsModel *et; - - et = gtk_type_new (gal_define_views_model_get_type ()); - - return E_TABLE_MODEL(et); -} - -/** - * gal_define_views_model_get_view: - * @model: The GalDefineViewsModel. - * @n: Which view to get. - * - * Gets the nth view. - * - * Returns: The view. - */ -GalView * -gal_define_views_model_get_view (GalDefineViewsModel *model, - int n) -{ - return gal_view_collection_get_view(model->collection, n); -} - -/** - * gal_define_views_model_delete_view: - * @model: The GalDefineViewsModel. - * @n: Which view to delete. - * - * Deletes the nth view. - */ -void -gal_define_views_model_delete_view (GalDefineViewsModel *model, - int n) -{ - e_table_model_pre_change(E_TABLE_MODEL(model)); - gal_view_collection_delete_view(model->collection, n); - e_table_model_row_deleted(E_TABLE_MODEL(model), n); -} - -/** - * gal_define_views_model_copy_view: - * @model: The GalDefineViewsModel. - * @n: Which view to copy. - * - * Copys the nth view. - */ -void -gal_define_views_model_copy_view (GalDefineViewsModel *model, - int n) -{ - ETableModel *etm = E_TABLE_MODEL(model); - e_table_model_pre_change(etm); - gal_view_collection_copy_view(model->collection, n); - e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1); -} diff --git a/widgets/menus/gal-define-views-model.h b/widgets/menus/gal-define-views-model.h deleted file mode 100644 index 2724216985..0000000000 --- a/widgets/menus/gal-define-views-model.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-model.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_DEFINE_VIEWS_MODEL_H_ -#define _GAL_DEFINE_VIEWS_MODEL_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_DEFINE_VIEWS_MODEL_TYPE (gal_define_views_model_get_type ()) -#define GAL_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_CAST ((o), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModel)) -#define GAL_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModelClass)) -#define GAL_IS_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_TYPE ((o), GAL_DEFINE_VIEWS_MODEL_TYPE)) -#define GAL_IS_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_DEFINE_VIEWS_MODEL_TYPE)) - -typedef struct { - ETableModel parent; - - /* item specific fields */ - GalViewCollection *collection; - - guint editable : 1; -} GalDefineViewsModel; - - -typedef struct { - ETableModelClass parent_class; -} GalDefineViewsModelClass; - - -GtkType gal_define_views_model_get_type (void); -ETableModel *gal_define_views_model_new (void); - -void gal_define_views_model_append (GalDefineViewsModel *model, - GalView *view); -GalView *gal_define_views_model_get_view (GalDefineViewsModel *model, - int i); -void gal_define_views_model_delete_view (GalDefineViewsModel *model, - int i); -void gal_define_views_model_copy_view (GalDefineViewsModel *model, - int i); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_DEFINE_VIEWS_MODEL_H_ */ diff --git a/widgets/menus/gal-define-views.glade b/widgets/menus/gal-define-views.glade deleted file mode 100644 index 72eac5764b..0000000000 --- a/widgets/menus/gal-define-views.glade +++ /dev/null @@ -1,311 +0,0 @@ - - - - - gal-define-views - gal-define-views - - src - pixmaps - C - True - True - True - False - False - False - True - - - - GnomeDialog - dialog1 - False - Define Views for "%s" - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button7 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkTable - table-top - 5 - 1 - False - 6 - 6 - - 0 - True - True - - - - GtkFrame - frame1 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - GtkTable - table-description - 6 - 1 - 2 - False - 6 - 6 - - - - - GtkHBox - hbox1 - False - 6 - - 0 - 1 - 1 - 2 - 0 - 0 - True - True - False - False - True - True - - - - Custom - custom-table - gal_define_views_dialog_create_etable - 0 - 0 - Fri, 10 Nov 2000 16:37:39 GMT - - 0 - True - True - - - - - GtkVBox - vbox1 - False - 6 - - 0 - False - False - - - - GtkButton - button-new - True - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - button-copy - True - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - button-modify - True - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - GtkButton - button-delete - True - - GTK_RELIEF_NORMAL - - 0 - False - False - - - - - - - GtkHButtonBox - hbuttonbox1 - GTK_BUTTONBOX_END - 6 - 85 - 27 - 7 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment3 - 0 - 0.5 - 0 - 1 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-reset - True - - GTK_RELIEF_NORMAL - - - - - GtkLabel - label-views - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - - - diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c deleted file mode 100644 index 675c926bc1..0000000000 --- a/widgets/menus/gal-view-collection.c +++ /dev/null @@ -1,838 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-collection.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "gal-view-collection.h" - -#define GVC_CLASS(e) ((GalViewCollectionClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *gal_view_collection_parent_class; - -#define d(x) x - -enum { - DISPLAY_VIEW, - CHANGED, - LAST_SIGNAL -}; - -static guint gal_view_collection_signals [LAST_SIGNAL] = { 0, }; - -/** - * gal_view_collection_display_view: - * @collection: The GalViewCollection to send the signal on. - * @view: The view to display. - * - */ -void -gal_view_collection_display_view (GalViewCollection *collection, - GalView *view) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - gtk_signal_emit (GTK_OBJECT (collection), - gal_view_collection_signals [DISPLAY_VIEW], - view); -} - -static void -gal_view_collection_changed (GalViewCollection *collection) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - - gtk_signal_emit (GTK_OBJECT (collection), - gal_view_collection_signals [CHANGED]); -} - -static void -gal_view_collection_item_free (GalViewCollectionItem *item) -{ - g_free(item->id); - if (item->view) { - if (item->view_changed_id) - gtk_signal_disconnect (GTK_OBJECT (item->view), - item->view_changed_id); - gtk_object_unref(GTK_OBJECT(item->view)); - } - g_free(item); -} - -static char * -gal_view_generate_string (GalViewCollection *collection, - GalView *view, - int which) -{ - char *ret_val; - char *pointer; - - if (which == 1) - ret_val = g_strdup(gal_view_get_title(view)); - else - ret_val = g_strdup_printf("%s_%d", gal_view_get_title(view), which); - for (pointer = ret_val; *pointer; pointer++) { - if (!isalnum((guint) *pointer)) { - *pointer = '_'; - } - } - return ret_val; -} - -static gint -gal_view_check_string (GalViewCollection *collection, - char *string) -{ - int i; - - if (!strcmp (string, "current_view")) - return FALSE; - - for (i = 0; i < collection->view_count; i++) { - if (!strcmp(string, collection->view_data[i]->id)) - return FALSE; - } - for (i = 0; i < collection->removed_view_count; i++) { - if (!strcmp(string, collection->removed_view_data[i]->id)) - return FALSE; - } - return TRUE; -} - -static char * -gal_view_generate_id (GalViewCollection *collection, - GalView *view) -{ - int i; - for (i = 1; TRUE; i++) { - char *try; - - try = gal_view_generate_string(collection, view, i); - if (gal_view_check_string(collection, try)) - return try; - g_free(try); - } -} - -static void -gal_view_collection_destroy (GtkObject *object) -{ - GalViewCollection *collection = GAL_VIEW_COLLECTION(object); - int i; - - for (i = 0; i < collection->view_count; i++) { - gal_view_collection_item_free (collection->view_data[i]); - } - g_free(collection->view_data); - collection->view_count = 0; - collection->view_data = NULL; - - e_free_object_list(collection->factory_list); - collection->factory_list = NULL; - - for (i = 0; i < collection->removed_view_count; i++) { - gal_view_collection_item_free (collection->removed_view_data[i]); - } - g_free(collection->removed_view_data); - collection->removed_view_count = 0; - collection->removed_view_data = NULL; - - g_free(collection->system_dir); - g_free(collection->local_dir); - collection->system_dir = NULL; - collection->local_dir = NULL; - - g_free (collection->default_view); - collection->default_view = NULL; - - g_free (collection->title); - collection->title = NULL; - - if (gal_view_collection_parent_class->destroy) - (*gal_view_collection_parent_class->destroy)(object); -} - -static void -gal_view_collection_class_init (GtkObjectClass *object_class) -{ - GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class); - gal_view_collection_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = gal_view_collection_destroy; - - gal_view_collection_signals [DISPLAY_VIEW] = - gtk_signal_new ("display_view", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, GAL_VIEW_TYPE); - - gal_view_collection_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GalViewCollectionClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_collection_signals, LAST_SIGNAL); - - klass->display_view = NULL; - klass->changed = NULL; -} - -static void -gal_view_collection_init (GalViewCollection *collection) -{ - collection->view_data = NULL; - collection->view_count = 0; - collection->factory_list = NULL; - - collection->removed_view_data = NULL; - collection->removed_view_count = 0; - - collection->system_dir = NULL; - collection->local_dir = NULL; - - collection->loaded = FALSE; - collection->default_view = NULL; - collection->default_view_built_in = TRUE; - - collection->title = NULL; -} - -/** - * gal_view_collection_get_type: - * - */ -guint -gal_view_collection_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewCollection", - sizeof (GalViewCollection), - sizeof (GalViewCollectionClass), - (GtkClassInitFunc) gal_view_collection_class_init, - (GtkObjectInitFunc) gal_view_collection_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * gal_view_collection_new: - * - * A collection of views and view factories. - */ -GalViewCollection * -gal_view_collection_new (void) -{ - return gtk_type_new(gal_view_collection_get_type()); -} - -void -gal_view_collection_set_title (GalViewCollection *collection, - const char *title) -{ - g_free (collection->title); - collection->title = g_strdup (title); -} - -/** - * gal_view_collection_set_storage_directories - * @collection: The view collection to initialize - * @system_dir: The location of the system built in views - * @local_dir: The location to store the users set up views - * - * Sets up the GalViewCollection. - */ -void -gal_view_collection_set_storage_directories (GalViewCollection *collection, - const char *system_dir, - const char *local_dir) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (system_dir != NULL); - g_return_if_fail (local_dir != NULL); - - g_free(collection->system_dir); - g_free(collection->local_dir); - - collection->system_dir = g_strdup(system_dir); - collection->local_dir = g_strdup(local_dir); -} - -/** - * gal_view_collection_add_factory - * @collection: The view collection to add a factory to - * @factory: The factory to add. The @collection will add a reference - * to the factory object, so you should unref it after calling this - * function if you no longer need it. - * - * Adds the given factory to this collection. This list is used both - * when loading views from their xml description as well as when the - * user tries to create a new view. - */ -void -gal_view_collection_add_factory (GalViewCollection *collection, - GalViewFactory *factory) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (factory != NULL); - g_return_if_fail (GAL_IS_VIEW_FACTORY (factory)); - - gtk_object_ref (GTK_OBJECT (factory)); - collection->factory_list = g_list_prepend (collection->factory_list, factory); -} - -static void -view_changed (GalView *view, - GalViewCollectionItem *item) -{ - item->changed = TRUE; - item->ever_changed = TRUE; - - gal_view_collection_changed(item->collection); -} - -/* Use factory list to load a GalView file. */ -static GalView * -gal_view_collection_real_load_view_from_file (GalViewCollection *collection, const char *type, const char *title, const char *dir, const char *filename) -{ - GalViewFactory *factory; - GList *factories; - - factory = NULL; - for (factories = collection->factory_list; factories; factories = factories->next) { - if (type && !strcmp(gal_view_factory_get_type_code(factories->data), type)) { - factory = factories->data; - break; - } - } - if (factory) { - GalView *view; - - view = gal_view_factory_new_view (factory, title); - gal_view_set_title (view, title); - gal_view_load(view, filename); - return view; - } - return NULL; -} - -GalView * -gal_view_collection_load_view_from_file (GalViewCollection *collection, const char *type, const char *filename) -{ - return gal_view_collection_real_load_view_from_file (collection, type, "", collection->local_dir, filename); -} - -static GalViewCollectionItem * -load_single_file (GalViewCollection *collection, - gchar *dir, - gboolean local, - xmlNode *node) -{ - GalViewCollectionItem *item; - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = local; - item->changed = FALSE; - item->built_in = !local; - item->id = e_xml_get_string_prop_by_name(node, "id"); - item->filename = e_xml_get_string_prop_by_name(node, "filename"); - item->title = e_xml_get_translated_utf8_string_prop_by_name(node, "title"); - item->type = e_xml_get_string_prop_by_name(node, "type"); - item->collection = collection; - item->view_changed_id = 0; - - if (item->filename) { - char *fullpath; - fullpath = g_concat_dir_and_file(dir, item->filename); - item->view = gal_view_collection_real_load_view_from_file (collection, item->type, item->title, dir, fullpath); - g_free(fullpath); - if (item->view) { - item->view_changed_id = - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - } - } - return item; -} - -static void -load_single_dir (GalViewCollection *collection, - char *dir, - gboolean local) -{ - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - char *filename = g_concat_dir_and_file(dir, "galview.xml"); - char *default_view; - - doc = xmlParseFile(filename); - if (!doc) { - g_free (filename); - return; - } - root = xmlDocGetRootElement(doc); - for (child = root->xmlChildrenNode; child; child = child->next) { - gchar *id = e_xml_get_string_prop_by_name(child, "id"); - gboolean found = FALSE; - int i; - - for (i = 0; i < collection->view_count; i++) { - if (!strcmp(id, collection->view_data[i]->id)) { - if (!local) - collection->view_data[i]->built_in = TRUE; - found = TRUE; - break; - } - } - if (!found) { - for (i = 0; i < collection->removed_view_count; i++) { - if (!strcmp(id, collection->removed_view_data[i]->id)) { - if (!local) - collection->removed_view_data[i]->built_in = TRUE; - found = TRUE; - break; - } - } - } - - if (!found) { - GalViewCollectionItem *item = load_single_file (collection, dir, local, child); - if (item->filename && *item->filename) { - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - } else { - collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); - collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; - } - } - g_free(id); - } - - default_view = e_xml_get_string_prop_by_name (root, "default-view"); - if (default_view) { - if (local) - collection->default_view_built_in = FALSE; - else - collection->default_view_built_in = TRUE; - g_free (collection->default_view); - collection->default_view = default_view; - } - - g_free(filename); - xmlFreeDoc(doc); -} - -/** - * gal_view_collection_load - * @collection: The view collection to load information for - * - * Loads the data from the system and user directories specified in - * set storage directories. This is primarily for internal use by - * other parts of gal_view. - */ -void -gal_view_collection_load (GalViewCollection *collection) -{ - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (collection->local_dir != NULL); - g_return_if_fail (collection->system_dir != NULL); - g_return_if_fail (!collection->loaded); - - e_create_directory(collection->local_dir); - - load_single_dir(collection, collection->local_dir, TRUE); - load_single_dir(collection, collection->system_dir, FALSE); - gal_view_collection_changed(collection); - - collection->loaded = TRUE; -} - -/** - * gal_view_collection_save - * @collection: The view collection to save information for - * - * Saves the data to the user directory specified in set storage - * directories. This is primarily for internal use by other parts of - * gal_view. - */ -void -gal_view_collection_save (GalViewCollection *collection) -{ - int i; - xmlDoc *doc; - xmlNode *root; - char *filename; - - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (collection->local_dir != NULL); - - doc = xmlNewDoc("1.0"); - root = xmlNewNode(NULL, "GalViewCollection"); - xmlDocSetRootElement(doc, root); - - if (collection->default_view && !collection->default_view_built_in) { - e_xml_set_string_prop_by_name(root, "default-view", collection->default_view); - } - - for (i = 0; i < collection->view_count; i++) { - xmlNode *child; - GalViewCollectionItem *item; - - item = collection->view_data[i]; - if (item->ever_changed) { - child = xmlNewChild(root, NULL, "GalView", NULL); - e_xml_set_string_prop_by_name(child, "id", item->id); - e_xml_set_string_prop_by_name(child, "title", item->title); - e_xml_set_string_prop_by_name(child, "filename", item->filename); - e_xml_set_string_prop_by_name(child, "type", item->type); - - if (item->changed) { - filename = g_concat_dir_and_file(collection->local_dir, item->filename); - gal_view_save(item->view, filename); - g_free(filename); - } - } - } - for (i = 0; i < collection->removed_view_count; i++) { - xmlNode *child; - GalViewCollectionItem *item; - - item = collection->removed_view_data[i]; - - child = xmlNewChild(root, NULL, "GalView", NULL); - e_xml_set_string_prop_by_name(child, "id", item->id); - e_xml_set_string_prop_by_name(child, "title", item->title); - e_xml_set_string_prop_by_name(child, "type", item->type); - } - filename = g_concat_dir_and_file(collection->local_dir, "galview.xml"); - xmlSaveFile(filename, doc); - xmlFreeDoc(doc); - g_free(filename); -} - -/** - * gal_view_collection_get_count - * @collection: The view collection to count - * - * Calculates the number of views in the given collection. - * - * Returns: The number of views in the collection. - */ -gint -gal_view_collection_get_count (GalViewCollection *collection) -{ - g_return_val_if_fail (collection != NULL, -1); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), -1); - - return collection->view_count; -} - -/** - * gal_view_collection_get_view - * @collection: The view collection to query - * @n: The view to get. - * - * Returns: The nth view in the collection - */ -GalView * -gal_view_collection_get_view (GalViewCollection *collection, - int n) -{ - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - g_return_val_if_fail (n < collection->view_count, NULL); - g_return_val_if_fail (n >= 0, NULL); - - return collection->view_data[n]->view; -} - -/** - * gal_view_collection_get_view_item - * @collection: The view collection to query - * @n: The view item to get. - * - * Returns: The nth view item in the collection - */ -GalViewCollectionItem * -gal_view_collection_get_view_item (GalViewCollection *collection, - int n) -{ - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - g_return_val_if_fail(n < collection->view_count, NULL); - g_return_val_if_fail(n >= 0, NULL); - - return collection->view_data[n]; -} - -int -gal_view_collection_get_view_index_by_id (GalViewCollection *collection, const char *view_id) -{ - int i; - for (i = 0; i < collection->view_count; i++) { - if (!strcmp (collection->view_data[i]->id, view_id)) - return i; - } - return -1; -} - -char * -gal_view_collection_get_view_id_by_index (GalViewCollection *collection, int n) -{ - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - g_return_val_if_fail(n < collection->view_count, NULL); - g_return_val_if_fail(n >= 0, NULL); - - return g_strdup (collection->view_data[n]->id); -} - - -void -gal_view_collection_append (GalViewCollection *collection, - GalView *view) -{ - GalViewCollectionItem *item; - - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = TRUE; - item->changed = TRUE; - item->built_in = FALSE; - item->title = g_strdup(gal_view_get_title(view)); - item->type = g_strdup(gal_view_get_type_code(view)); - item->id = gal_view_generate_id(collection, view); - item->filename = g_strdup_printf("%s.galview", item->id); - item->view = view; - item->collection = collection; - gtk_object_ref(GTK_OBJECT(view)); - - item->view_changed_id = - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - - gal_view_collection_changed(collection); -} - -void -gal_view_collection_delete_view (GalViewCollection *collection, - int i) -{ - GalViewCollectionItem *item; - - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (i >= 0 && i < collection->view_count); - - item = collection->view_data[i]; - memmove(collection->view_data + i, collection->view_data + i + 1, (collection->view_count - i - 1) * sizeof(GalViewCollectionItem *)); - collection->view_count --; - if (item->built_in) { - g_free(item->filename); - item->filename = NULL; - - collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1); - collection->removed_view_data[collection->removed_view_count] = item; - collection->removed_view_count ++; - } else { - gal_view_collection_item_free (item); - } - - gal_view_collection_changed(collection); -} - -void -gal_view_collection_copy_view (GalViewCollection *collection, - int i) -{ - GalViewCollectionItem *item; - GalView *view; - - g_return_if_fail (collection != NULL); - g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection)); - g_return_if_fail (i >= 0 && i < collection->view_count); - - view = collection->view_data[i]->view; - - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = TRUE; - item->changed = FALSE; - item->built_in = FALSE; - item->title = g_strdup(gal_view_get_title(view)); - item->type = g_strdup(gal_view_get_type_code(view)); - item->id = gal_view_generate_id(collection, view); - item->filename = g_strdup_printf("%s.galview", item->id); - item->view = gal_view_clone(view); - item->collection = collection; - - item->view_changed_id = - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - - gal_view_collection_changed(collection); -} - -gboolean -gal_view_collection_loaded (GalViewCollection *collection) -{ - return collection->loaded; -} - -const char * -gal_view_collection_append_with_title (GalViewCollection *collection, const char *title, GalView *view) -{ - GalViewCollectionItem *item; - - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - gal_view_set_title (view, title); - - d(g_print("%s: %p\n", __FUNCTION__, view)); - - item = g_new(GalViewCollectionItem, 1); - item->ever_changed = TRUE; - item->changed = TRUE; - item->built_in = FALSE; - item->title = g_strdup(gal_view_get_title(view)); - item->type = g_strdup(gal_view_get_type_code(view)); - item->id = gal_view_generate_id(collection, view); - item->filename = g_strdup_printf("%s.galview", item->id); - item->view = view; - item->collection = collection; - gtk_object_ref(GTK_OBJECT(view)); - - item->view_changed_id = - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); - collection->view_data[collection->view_count] = item; - collection->view_count ++; - - gal_view_collection_changed(collection); - return item->id; -} - -const char * -gal_view_collection_set_nth_view (GalViewCollection *collection, int i, GalView *view) -{ - GalViewCollectionItem *item; - - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - g_return_val_if_fail (i >= 0, NULL); - g_return_val_if_fail (i < collection->view_count, NULL); - - d(g_print("%s: %p\n", __FUNCTION__, view)); - - item = collection->view_data[i]; - - gal_view_set_title (view, item->title); - gtk_object_ref (GTK_OBJECT (view)); - if (item->view) { - gtk_signal_disconnect (GTK_OBJECT (item->view), - item->view_changed_id); - gtk_object_unref (GTK_OBJECT (item->view)); - } - item->view = view; - - item->ever_changed = TRUE; - item->changed = TRUE; - item->type = g_strdup(gal_view_get_type_code(view)); - - item->view_changed_id = - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - - gal_view_collection_changed (collection); - return item->id; -} - -const char * -gal_view_collection_get_default_view (GalViewCollection *collection) -{ - return collection->default_view; -} - -void -gal_view_collection_set_default_view (GalViewCollection *collection, const char *id) -{ - g_free (collection->default_view); - collection->default_view = g_strdup (id); - gal_view_collection_changed (collection); - collection->default_view_built_in = FALSE; -} diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h deleted file mode 100644 index 68e7cae4b7..0000000000 --- a/widgets/menus/gal-view-collection.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-collection.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_SET_H_ -#define _GAL_VIEW_SET_H_ - -#include -#include -#include - -BEGIN_GNOME_DECLS - - -#define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ()) -#define GAL_VIEW_COLLECTION(o) (GTK_CHECK_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection)) -#define GAL_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass)) -#define GAL_IS_VIEW_COLLECTION(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_COLLECTION_TYPE)) -#define GAL_IS_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE)) - -typedef struct GalViewCollectionItem GalViewCollectionItem; - -typedef struct { - GtkObject base; - - GalViewCollectionItem **view_data; - int view_count; - - GList *factory_list; - - GalViewCollectionItem **removed_view_data; - int removed_view_count; - - guint loaded : 1; - guint default_view_built_in : 1; - - char *system_dir; - char *local_dir; - - char *default_view; - - char *title; -} GalViewCollection; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - void (*display_view) (GalViewCollection *collection, - GalView *view); - void (*changed) (GalViewCollection *collection); -} GalViewCollectionClass; - -struct GalViewCollectionItem { - GalView *view; - char *id; - guint changed : 1; - guint ever_changed : 1; - guint built_in : 1; - char *filename; - char *title; - char *type; - GalViewCollection *collection; - guint view_changed_id; -}; - -/* Standard functions */ -GtkType gal_view_collection_get_type (void); -GalViewCollection *gal_view_collection_new (void); - -void gal_view_collection_set_title (GalViewCollection *collection, - const char *title); -/* Set up the view collection. Call these two functions before ever doing load or save and never call them again. */ -void gal_view_collection_set_storage_directories (GalViewCollection *collection, - const char *system_dir, - const char *local_dir); -void gal_view_collection_add_factory (GalViewCollection *collection, - GalViewFactory *factory); - -/* Send the display view signal. This function is deprecated. */ -void gal_view_collection_display_view (GalViewCollection *collection, - GalView *view); - - -/* Query the view collection. */ -gint gal_view_collection_get_count (GalViewCollection *collection); -GalView *gal_view_collection_get_view (GalViewCollection *collection, - int n); -GalViewCollectionItem *gal_view_collection_get_view_item (GalViewCollection *collection, - int n); -int gal_view_collection_get_view_index_by_id (GalViewCollection *collection, - const char *view_id); -char *gal_view_collection_get_view_id_by_index (GalViewCollection *collection, - int n); - -/* Manipulate the view collection */ -void gal_view_collection_append (GalViewCollection *collection, - GalView *view); -void gal_view_collection_delete_view (GalViewCollection *collection, - int i); -void gal_view_collection_copy_view (GalViewCollection *collection, - int i); -/* Call set_storage_directories and add factories for anything that - * might be found there before doing either of these. */ -void gal_view_collection_load (GalViewCollection *collection); -void gal_view_collection_save (GalViewCollection *collection); -gboolean gal_view_collection_loaded (GalViewCollection *collection); - -/* Use factory list to load a GalView file. */ -GalView *gal_view_collection_load_view_from_file (GalViewCollection *collection, - const char *type, - const char *filename); - -/* Returns id of the new view. These functions are used for - GalViewInstanceSaveAsDialog. */ -const char *gal_view_collection_append_with_title (GalViewCollection *collection, - const char *title, - GalView *view); -const char *gal_view_collection_set_nth_view (GalViewCollection *collection, - int i, - GalView *view); - -const char *gal_view_collection_get_default_view (GalViewCollection *collection); -void gal_view_collection_set_default_view (GalViewCollection *collection, - const char *id); - - -END_GNOME_DECLS - - -#endif /* _GAL_VIEW_COLLECTION_H_ */ diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c deleted file mode 100644 index f81482435d..0000000000 --- a/widgets/menus/gal-view-etable.c +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-etable.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include -#include "gal-view-etable.h" -#include - -#define PARENT_TYPE gal_view_get_type () - -static GalViewClass *gal_view_etable_parent_class; - -static void -detach_table (GalViewEtable *view) -{ - if (view->table == NULL) - return; - if (view->table_state_changed_id) { - gtk_signal_disconnect (GTK_OBJECT (view->table), - view->table_state_changed_id); - view->table_state_changed_id = 0; - } - gtk_object_unref (GTK_OBJECT (view->table)); - view->table = NULL; -} - -static void -detach_tree (GalViewEtable *view) -{ - if (view->tree == NULL) - return; - if (view->tree_state_changed_id) { - gtk_signal_disconnect (GTK_OBJECT (view->tree), - view->tree_state_changed_id); - view->tree_state_changed_id = 0; - } - gtk_object_unref (GTK_OBJECT (view->tree)); - view->tree = NULL; -} - -static void -config_changed (ETableConfig *config, GalViewEtable *view) -{ - ETableState *state; - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - gtk_object_get (GTK_OBJECT (config), - "state", &state, - NULL); - view->state = e_table_state_duplicate(state); - gal_view_changed(GAL_VIEW(view)); -} - -static void -gal_view_etable_edit (GalView *view) -{ - GalViewEtable *etable_view = GAL_VIEW_ETABLE(view); - ETableConfig *config; - - config = e_table_config_new(etable_view->title, - etable_view->spec, - etable_view->state); - - gtk_signal_connect(GTK_OBJECT(config), "changed", - GTK_SIGNAL_FUNC(config_changed), view); -} - -static void -gal_view_etable_load (GalView *view, - const char *filename) -{ - e_table_state_load_from_file(GAL_VIEW_ETABLE(view)->state, filename); -} - -static void -gal_view_etable_save (GalView *view, - const char *filename) -{ - e_table_state_save_to_file(GAL_VIEW_ETABLE(view)->state, filename); -} - -static const char * -gal_view_etable_get_title (GalView *view) -{ - return GAL_VIEW_ETABLE(view)->title; -} - -static void -gal_view_etable_set_title (GalView *view, - const char *title) -{ - g_free(GAL_VIEW_ETABLE(view)->title); - GAL_VIEW_ETABLE(view)->title = g_strdup(title); -} - -static const char * -gal_view_etable_get_type_code (GalView *view) -{ - return "etable"; -} - -static GalView * -gal_view_etable_clone (GalView *view) -{ - GalViewEtable *gve, *new; - - gve = GAL_VIEW_ETABLE(view); - - new = gtk_type_new (gal_view_etable_get_type ()); - new->spec = gve->spec; - new->title = g_strdup (gve->title); - new->state = e_table_state_duplicate(gve->state); - - gtk_object_ref(GTK_OBJECT(new->spec)); - - return GAL_VIEW(new); -} - -static void -gal_view_etable_destroy (GtkObject *object) -{ - GalViewEtable *view = GAL_VIEW_ETABLE(object); - - gal_view_etable_detach (view); - - g_free(view->title); - if (view->spec) - gtk_object_unref(GTK_OBJECT(view->spec)); - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - - if (GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) - (* GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) (object); -} - -static void -gal_view_etable_class_init (GtkObjectClass *object_class) -{ - GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class); - gal_view_etable_parent_class = gtk_type_class (PARENT_TYPE); - - gal_view_class->edit = gal_view_etable_edit ; - gal_view_class->load = gal_view_etable_load ; - gal_view_class->save = gal_view_etable_save ; - gal_view_class->get_title = gal_view_etable_get_title ; - gal_view_class->set_title = gal_view_etable_set_title ; - gal_view_class->get_type_code = gal_view_etable_get_type_code; - gal_view_class->clone = gal_view_etable_clone ; - - object_class->destroy = gal_view_etable_destroy ; -} - -static void -gal_view_etable_init (GalViewEtable *gve) -{ - gve->spec = NULL; - gve->state = e_table_state_new(); - gve->title = NULL; -} - -GtkType -gal_view_etable_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewEtable", - sizeof (GalViewEtable), - sizeof (GalViewEtableClass), - (GtkClassInitFunc) gal_view_etable_class_init, - (GtkObjectInitFunc) gal_view_etable_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -/** - * gal_view_etable_new - * @spec: The ETableSpecification that this view will be based upon. - * @title: The name of the new view. - * - * Returns a new GalViewEtable. This is primarily for use by - * GalViewFactoryEtable. - * - * Returns: The new GalViewEtable. - */ -GalView * -gal_view_etable_new (ETableSpecification *spec, - const gchar *title) -{ - return gal_view_etable_construct (gtk_type_new (gal_view_etable_get_type ()), spec, title); -} - -/** - * gal_view_etable_construct - * @view: The view to construct. - * @spec: The ETableSpecification that this view will be based upon. - * @title: The name of the new view. - * - * constructs the GalViewEtable. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewEtable. - */ -GalView * -gal_view_etable_construct (GalViewEtable *view, - ETableSpecification *spec, - const gchar *title) -{ - if (spec) - gtk_object_ref(GTK_OBJECT(spec)); - view->spec = spec; - - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - view->state = e_table_state_duplicate(spec->state); - - view->title = g_strdup(title); - - return GAL_VIEW(view); -} - -void -gal_view_etable_set_state (GalViewEtable *view, ETableState *state) -{ - if (view->state) - gtk_object_unref(GTK_OBJECT(view->state)); - view->state = e_table_state_duplicate(state); - - gal_view_changed(GAL_VIEW(view)); -} - -static void -table_state_changed (ETable *table, GalViewEtable *view) -{ - ETableState *state; - - state = e_table_get_state_object (table); - gtk_object_unref (GTK_OBJECT (view->state)); - view->state = state; - - gal_view_changed(GAL_VIEW(view)); -} - -static void -tree_state_changed (ETree *tree, GalViewEtable *view) -{ - ETableState *state; - - state = e_tree_get_state_object (tree); - gtk_object_unref (GTK_OBJECT (view->state)); - view->state = state; - - gal_view_changed(GAL_VIEW(view)); -} - -void -gal_view_etable_attach_table (GalViewEtable *view, ETable *table) -{ - gal_view_etable_detach (view); - - view->table = table; - - e_table_set_state_object(view->table, view->state); - gtk_object_ref (GTK_OBJECT (view->table)); - view->table_state_changed_id = - gtk_signal_connect(GTK_OBJECT(view->table), "state_change", - GTK_SIGNAL_FUNC (table_state_changed), view); -} - -void -gal_view_etable_attach_tree (GalViewEtable *view, ETree *tree) -{ - gal_view_etable_detach (view); - - view->tree = tree; - - e_tree_set_state_object(view->tree, view->state); - gtk_object_ref (GTK_OBJECT (view->tree)); - view->tree_state_changed_id = - gtk_signal_connect(GTK_OBJECT(view->tree), "state_change", - GTK_SIGNAL_FUNC (tree_state_changed), view); -} - -void -gal_view_etable_detach (GalViewEtable *view) -{ - if (view->table != NULL) - detach_table (view); - if (view->tree != NULL) - detach_tree (view); -} diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h deleted file mode 100644 index 2fd001e583..0000000000 --- a/widgets/menus/gal-view-etable.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-etable.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_ETABLE_H_ -#define _GAL_VIEW_ETABLE_H_ - -#include -#include -#include -#include -#include -#include -#include - -BEGIN_GNOME_DECLS - -#define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ()) -#define GAL_VIEW_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable)) -#define GAL_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass)) -#define GAL_IS_VIEW_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_ETABLE_TYPE)) -#define GAL_IS_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_ETABLE_TYPE)) - -typedef struct { - GalView base; - - ETableSpecification *spec; - ETableState *state; - char *title; - - ETable *table; - guint table_state_changed_id; - - ETree *tree; - guint tree_state_changed_id; -} GalViewEtable; - -typedef struct { - GalViewClass parent_class; -} GalViewEtableClass; - -/* Standard functions */ -GtkType gal_view_etable_get_type (void); -GalView *gal_view_etable_new (ETableSpecification *spec, - const gchar *title); -GalView *gal_view_etable_construct (GalViewEtable *view, - ETableSpecification *spec, - const gchar *title); -void gal_view_etable_set_state (GalViewEtable *view, - ETableState *state); -void gal_view_etable_attach_table (GalViewEtable *view, - ETable *table); -void gal_view_etable_attach_tree (GalViewEtable *view, - ETree *tree); -void gal_view_etable_detach (GalViewEtable *view); - -END_GNOME_DECLS - -#endif /* _GAL_VIEW_ETABLE_H_ */ diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c deleted file mode 100644 index 026d085145..0000000000 --- a/widgets/menus/gal-view-factory-etable.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory-etable.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include "gal/util/e-i18n.h" -#include "gal-view-factory-etable.h" -#include "gal-view-etable.h" - -#define GVFE_CLASS(e) ((GalViewFactoryEtableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gal_view_factory_get_type () - -static GalViewFactoryClass *gal_view_factory_etable_parent_class; - -static const char * -gal_view_factory_etable_get_title (GalViewFactory *factory) -{ - return _("Table"); -} - -static GalView * -gal_view_factory_etable_new_view (GalViewFactory *factory, - const char *name) -{ - return gal_view_etable_new(GAL_VIEW_FACTORY_ETABLE(factory)->spec, name); -} - -static const char * -gal_view_factory_etable_get_type_code (GalViewFactory *factory) -{ - return "etable"; -} - -static void -gal_view_factory_etable_destroy (GtkObject *object) -{ - GalViewFactoryEtable *factory = GAL_VIEW_FACTORY_ETABLE(object); - - if (factory->spec) - gtk_object_unref(GTK_OBJECT(factory->spec)); - - if (GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) - (* GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) (object); -} - -static void -gal_view_factory_etable_class_init (GtkObjectClass *object_class) -{ - GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_etable_parent_class = gtk_type_class (PARENT_TYPE); - - view_factory_class->get_title = gal_view_factory_etable_get_title; - view_factory_class->new_view = gal_view_factory_etable_new_view; - view_factory_class->get_type_code = gal_view_factory_etable_get_type_code; - - object_class->destroy = gal_view_factory_etable_destroy; -} - -static void -gal_view_factory_etable_init (GalViewFactoryEtable *factory) -{ - factory->spec = NULL; -} - -/** - * gal_view_etable_new - * @spec: The spec to create GalViewEtables based upon. - * - * A new GalViewFactory for creating ETable views. Create one of - * these and pass it to GalViewCollection for use. - * - * Returns: The new GalViewFactoryEtable. - */ -GalViewFactory * -gal_view_factory_etable_new (ETableSpecification *spec) -{ - return gal_view_factory_etable_construct (gtk_type_new (gal_view_factory_etable_get_type ()), spec); -} - -/** - * gal_view_etable_construct - * @factory: The factory to construct - * @spec: The spec to create GalViewEtables based upon. - * - * constructs the GalViewFactoryEtable. To be used by subclasses and - * language bindings. - * - * Returns: The GalViewFactoryEtable. - */ -GalViewFactory * -gal_view_factory_etable_construct (GalViewFactoryEtable *factory, - ETableSpecification *spec) -{ - if (spec) - gtk_object_ref(GTK_OBJECT(spec)); - factory->spec = spec; - return GAL_VIEW_FACTORY(factory); -} - -GtkType -gal_view_factory_etable_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewFactoryEtable", - sizeof (GalViewFactoryEtable), - sizeof (GalViewFactoryEtableClass), - (GtkClassInitFunc) gal_view_factory_etable_class_init, - (GtkObjectInitFunc) gal_view_factory_etable_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view-factory-etable.h b/widgets/menus/gal-view-factory-etable.h deleted file mode 100644 index 502f39b5f6..0000000000 --- a/widgets/menus/gal-view-factory-etable.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory-etable.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_FACTORY_ETABLE_H_ -#define _GAL_VIEW_FACTORY_ETABLE_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_FACTORY_ETABLE_TYPE (gal_view_factory_etable_get_type ()) -#define GAL_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable)) -#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass)) -#define GAL_IS_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE)) -#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE)) - -typedef struct { - GalViewFactory base; - - ETableSpecification *spec; -} GalViewFactoryEtable; - -typedef struct { - GalViewFactoryClass parent_class; -} GalViewFactoryEtableClass; - -/* Standard functions */ -GtkType gal_view_factory_etable_get_type (void); -GalViewFactory *gal_view_factory_etable_new (ETableSpecification *spec); -GalViewFactory *gal_view_factory_etable_construct (GalViewFactoryEtable *factory, - ETableSpecification *spec); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_VIEW_FACTORY_ETABLE_H_ */ diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c deleted file mode 100644 index 0f0d274b06..0000000000 --- a/widgets/menus/gal-view-factory.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include "gal-view-factory.h" - -#define GVF_CLASS(e) ((GalViewFactoryClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -#define d(x) - -d(static gint depth = 0;) - -static GtkObjectClass *gal_view_factory_parent_class; - -/** - * gal_view_factory_get_title: - * @factory: The factory to query. - * - * Returns: The title of the factory. - */ -const char * -gal_view_factory_get_title (GalViewFactory *factory) -{ - g_return_val_if_fail (factory != NULL, 0); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), 0); - - if (GVF_CLASS (factory)->get_title) - return GVF_CLASS (factory)->get_title (factory); - else - return NULL; -} - -/** - * gal_view_factory_new_view: - * @factory: The factory to use - * @name: the name for the view. - * - * Returns: The new view - */ -GalView * -gal_view_factory_new_view (GalViewFactory *factory, - const char *name) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL); - - if (GVF_CLASS (factory)->new_view) - return GVF_CLASS (factory)->new_view (factory, name); - else - return NULL; -} - -/** - * gal_view_factory_get_type_code: - * @factory: The factory to use - * - * Returns: The type code - */ -const char * -gal_view_factory_get_type_code (GalViewFactory *factory) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL); - - if (GVF_CLASS (factory)->get_type_code) - return GVF_CLASS (factory)->get_type_code (factory); - else - return NULL; -} - -static void -gal_view_factory_class_init (GtkObjectClass *object_class) -{ - GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class); - gal_view_factory_parent_class = gtk_type_class (PARENT_TYPE); - - klass->get_title = NULL; - klass->new_view = NULL; -} - -GtkType -gal_view_factory_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewFactory", - sizeof (GalViewFactory), - sizeof (GalViewFactoryClass), - (GtkClassInitFunc) gal_view_factory_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view-factory.h b/widgets/menus/gal-view-factory.h deleted file mode 100644 index b02c728517..0000000000 --- a/widgets/menus/gal-view-factory.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-factory.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_FACTORY_H_ -#define _GAL_VIEW_FACTORY_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_FACTORY_TYPE (gal_view_factory_get_type ()) -#define GAL_VIEW_FACTORY(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory)) -#define GAL_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass)) -#define GAL_IS_VIEW_FACTORY(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_TYPE)) -#define GAL_IS_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE)) - -typedef struct { - GtkObject base; -} GalViewFactory; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Virtual methods - */ - const char *(*get_title) (GalViewFactory *factory); - const char *(*get_type_code) (GalViewFactory *factory); - GalView *(*new_view) (GalViewFactory *factory, - const char *name); -} GalViewFactoryClass; - -/* Standard functions */ -GtkType gal_view_factory_get_type (void); - -/* Query functions */ -/* Returns already translated title. */ -const char *gal_view_factory_get_title (GalViewFactory *factory); - -/* Returns the code for use in identifying this type of object in the - * view list. This identifier should identify this as being the - * unique factory for xml files which were written out with this - * identifier. Thus each factory should have a unique type code. */ -const char *gal_view_factory_get_type_code (GalViewFactory *factory); - -/* Create a new view */ -GalView *gal_view_factory_new_view (GalViewFactory *factory, - const char *name); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _GAL_VIEW_FACTORY_H_ */ diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c deleted file mode 100644 index c00937b46f..0000000000 --- a/widgets/menus/gal-view-instance-save-as-dialog.c +++ /dev/null @@ -1,312 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-dialog.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "gal-view-instance-save-as-dialog.h" - -#include -#include -#include "gal-define-views-model.h" -#include "gal-view-new-dialog.h" -#include -#include - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, - ARG_INSTANCE, -}; - -typedef struct { - char *title; - ETableModel *model; - GalViewInstanceSaveAsDialog *names; -} GalViewInstanceSaveAsDialogChild; - - -/* Static functions */ -static void -gal_view_instance_save_as_dialog_set_instance(GalViewInstanceSaveAsDialog *dialog, - GalViewInstance *instance) -{ - dialog->instance = instance; - if (dialog->model) { - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", instance ? instance->collection : NULL, - NULL); - } -} - -static void -gvisad_setup_radio_buttons (GalViewInstanceSaveAsDialog *dialog) -{ - GtkWidget *radio_replace = glade_xml_get_widget (dialog->gui, "radiobutton-replace"); - GtkWidget *radio_create = glade_xml_get_widget (dialog->gui, "radiobutton-create" ); - GtkWidget *widget; - GtkNotebook *notebook = GTK_NOTEBOOK (glade_xml_get_widget (dialog->gui, "notebook-help")); - - widget = glade_xml_get_widget (dialog->gui, "custom-replace"); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_replace))) { - gtk_widget_set_sensitive (widget, TRUE); - gtk_notebook_set_page (notebook, 0); - dialog->toggle = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE; - } else { - gtk_widget_set_sensitive (widget, FALSE); - } - - widget = glade_xml_get_widget (dialog->gui, "entry-create"); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_create))) { - gtk_widget_set_sensitive (widget, TRUE); - gtk_notebook_set_page (notebook, 1); - dialog->toggle = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE; - } else { - gtk_widget_set_sensitive (widget, FALSE); - } -} - -static void -gvisad_radio_toggled (GtkWidget *widget, GalViewInstanceSaveAsDialog *dialog) -{ - gvisad_setup_radio_buttons (dialog); -} - -static void -gvisad_connect_signal(GalViewInstanceSaveAsDialog *dialog, char *widget_name, char *signal, GtkSignalFunc handler) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget(dialog->gui, widget_name); - - if (widget) - gtk_signal_connect(GTK_OBJECT(widget), signal, handler, dialog); -} - -/* Method override implementations */ -static void -gal_view_instance_save_as_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalViewInstanceSaveAsDialog *dialog; - - dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (o); - - switch (arg_id){ - case ARG_INSTANCE: - if (GTK_VALUE_OBJECT(*arg)) - gal_view_instance_save_as_dialog_set_instance(dialog, GAL_VIEW_INSTANCE(GTK_VALUE_OBJECT(*arg))); - else - gal_view_instance_save_as_dialog_set_instance(dialog, NULL); - break; - - default: - return; - } -} - -static void -gal_view_instance_save_as_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalViewInstanceSaveAsDialog *dialog; - - dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (object); - - switch (arg_id) { - case ARG_INSTANCE: - if (dialog->instance) - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(dialog->instance); - else - GTK_VALUE_OBJECT(*arg) = NULL; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -gal_view_instance_save_as_dialog_destroy (GtkObject *object) -{ - GalViewInstanceSaveAsDialog *gal_view_instance_save_as_dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG(object); - - gtk_object_unref(GTK_OBJECT(gal_view_instance_save_as_dialog->gui)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* Init functions */ -static void -gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = gal_view_instance_save_as_dialog_set_arg; - object_class->get_arg = gal_view_instance_save_as_dialog_get_arg; - object_class->destroy = gal_view_instance_save_as_dialog_destroy; - - gtk_object_add_arg_type("GalViewInstanceSaveAsDialog::instance", GAL_VIEW_INSTANCE_TYPE, - GTK_ARG_READWRITE, ARG_INSTANCE); -} - -static void -gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog) -{ - GladeXML *gui; - GtkWidget *widget; - GtkWidget *etable; - - dialog->instance = NULL; - - gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-view-instance-save-as-dialog.glade", NULL, PACKAGE); - dialog->gui = gui; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_widget_unparent(widget); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gvisad_connect_signal(dialog, "radiobutton-replace", "toggled", GTK_SIGNAL_FUNC(gvisad_radio_toggled)); - gvisad_connect_signal(dialog, "radiobutton-create", "toggled", GTK_SIGNAL_FUNC(gvisad_radio_toggled)); - - dialog->model = NULL; - etable = glade_xml_get_widget(dialog->gui, "custom-replace"); - if (etable) { - dialog->model = gtk_object_get_data(GTK_OBJECT(etable), "GalViewInstanceSaveAsDialog::model"); - gtk_object_set(GTK_OBJECT(dialog->model), - "collection", dialog->instance ? dialog->instance->collection : NULL, - NULL); - } - - gvisad_setup_radio_buttons (dialog); - gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); -} - - -/* For use from libglade. */ -/* ETable creation */ -#define SPEC "" \ - "" \ - " " \ - "" - -GtkWidget *gal_view_instance_save_as_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2); - -GtkWidget * -gal_view_instance_save_as_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2) -{ - GtkWidget *table; - ETableModel *model; - model = gal_define_views_model_new(); - table = e_table_scrolled_new(model, NULL, SPEC, NULL); - gtk_object_set_data(GTK_OBJECT(table), "GalViewInstanceSaveAsDialog::model", model); - return table; -} - -/* External methods */ -/** - * gal_view_instance_save_as_dialog_new - * - * Returns a new dialog for defining views. - * - * Returns: The GalViewInstanceSaveAsDialog. - */ -GtkWidget* -gal_view_instance_save_as_dialog_new (GalViewInstance *instance) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (gal_view_instance_save_as_dialog_get_type ())); - gal_view_instance_save_as_dialog_set_instance(GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (widget), instance); - return widget; -} - -GtkType -gal_view_instance_save_as_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "GalViewInstanceSaveAsDialog", - sizeof (GalViewInstanceSaveAsDialog), - sizeof (GalViewInstanceSaveAsDialogClass), - (GtkClassInitFunc) gal_view_instance_save_as_dialog_class_init, - (GtkObjectInitFunc) gal_view_instance_save_as_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -void -gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog) -{ - GalView *view = gal_view_instance_get_current_view (dialog->instance); - GtkWidget *widget; - char *title; - int n; - const char *id = NULL; - switch (dialog->toggle) { - case GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE: - widget = glade_xml_get_widget(dialog->gui, "custom-replace"); - if (widget && E_IS_TABLE_SCROLLED (widget)) { - n = e_table_get_cursor_row (e_table_scrolled_get_table (E_TABLE_SCROLLED (widget))); - id = gal_view_collection_set_nth_view (dialog->instance->collection, n, view); - gal_view_collection_save (dialog->instance->collection); - } - break; - case GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE: - widget = glade_xml_get_widget(dialog->gui, "entry-create"); - if (widget && GTK_IS_ENTRY (widget)) { - title = gtk_entry_get_text (GTK_ENTRY (widget)); - id = gal_view_collection_append_with_title (dialog->instance->collection, title, view); - gal_view_collection_save (dialog->instance->collection); - } - break; - } - - if (id) { - gal_view_instance_set_current_view_id (dialog->instance, id); - } -} diff --git a/widgets/menus/gal-view-instance-save-as-dialog.glade b/widgets/menus/gal-view-instance-save-as-dialog.glade deleted file mode 100644 index bc5d99dd58..0000000000 --- a/widgets/menus/gal-view-instance-save-as-dialog.glade +++ /dev/null @@ -1,269 +0,0 @@ - - - - - gal-view-instance-save-as-dialog - gal-view-instance-save-as-dialog - - src - pixmaps - C - True - True - True - False - False - False - True - - - - GnomeDialog - dialog1 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkTable - table-top - 5 - 1 - False - 0 - 0 - - 0 - True - True - - - - GtkNotebook - notebook-help - False - False - GTK_POS_TOP - False - 2 - 2 - False - - 0 - 1 - 4 - 5 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label6 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - Notebook:tab - label4 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - Notebook:tab - label5 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - Custom - custom-replace - gal_view_instance_save_as_dialog_create_etable - 0 - 0 - Fri, 01 Feb 2002 20:18:32 GMT - - 0 - 1 - 3 - 4 - 0 - 0 - False - True - False - False - True - True - - - - - GtkEntry - entry-create - False - True - True - True - 0 - - - 0 - 1 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkRadioButton - radiobutton-replace - True - - False - True - choice-group - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - radiobutton-create - True - - True - True - choice-group - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - - - diff --git a/widgets/menus/gal-view-instance-save-as-dialog.h b/widgets/menus/gal-view-instance-save-as-dialog.h deleted file mode 100644 index 567e00d7b0..0000000000 --- a/widgets/menus/gal-view-instance-save-as-dialog.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-define-views-dialog.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_H__ -#define __GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* GalViewInstanceSaveAsDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE (gal_view_instance_save_as_dialog_get_type ()) -#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE, GalViewInstanceSaveAsDialog)) -#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE, GalViewInstanceSaveAsDialogClass)) -#define GAL_IS_VIEW_INSTANCE_SAVE_AS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE)) -#define GAL_IS_VIEW_INSTANCE_SAVE_AS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE)) - -typedef struct _GalViewInstanceSaveAsDialog GalViewInstanceSaveAsDialog; -typedef struct _GalViewInstanceSaveAsDialogClass GalViewInstanceSaveAsDialogClass; - -typedef enum { - GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE, - GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE -} GalViewInstanceSaveAsDialogToggle; - -struct _GalViewInstanceSaveAsDialog -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - ETableModel *model; - - GalViewInstance *instance; - GalViewCollection *collection; - - GalViewInstanceSaveAsDialogToggle toggle; -}; - -struct _GalViewInstanceSaveAsDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkWidget *gal_view_instance_save_as_dialog_new (GalViewInstance *instance); -GtkType gal_view_instance_save_as_dialog_get_type (void); - -void gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_H__ */ diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c deleted file mode 100644 index 1cc0389f47..0000000000 --- a/widgets/menus/gal-view-instance.c +++ /dev/null @@ -1,620 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-instance.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "gal-view-instance.h" -#include "gal-view-instance-save-as-dialog.h" -#include "gal-define-views-dialog.h" -#include -#include -#include - -#define GVI_CLASS(e) ((GalViewInstanceClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *gal_view_instance_parent_class; - -static const EPopupMenu separator = E_POPUP_SEPARATOR; -static const EPopupMenu terminator = E_POPUP_TERMINATOR; - - -#define d(x) x - -enum { - DISPLAY_VIEW, - CHANGED, - LAST_SIGNAL -}; - -static guint gal_view_instance_signals [LAST_SIGNAL] = { 0, }; - -static void -gal_view_instance_changed (GalViewInstance *instance) -{ - g_return_if_fail (instance != NULL); - g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance)); - - gtk_signal_emit (GTK_OBJECT (instance), - gal_view_instance_signals [CHANGED]); -} - -static void -gal_view_instance_display_view (GalViewInstance *instance, GalView *view) -{ - g_return_if_fail (instance != NULL); - g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance)); - - gtk_signal_emit (GTK_OBJECT (instance), - gal_view_instance_signals [DISPLAY_VIEW], - view); -} - -static void -save_current_view (GalViewInstance *instance) -{ - xmlDoc *doc; - xmlNode *root; - - doc = xmlNewDoc("1.0"); - root = xmlNewNode (NULL, "GalViewCurrentView"); - xmlDocSetRootElement(doc, root); - - if (instance->current_id) - e_xml_set_string_prop_by_name (root, "current_view", instance->current_id); - if (instance->current_type) - e_xml_set_string_prop_by_name (root, "current_view_type", instance->current_type); - - xmlSaveFile(instance->current_view_filename, doc); - xmlFreeDoc(doc); -} - -static void -view_changed (GalView *view, GalViewInstance *instance) -{ - if (instance->current_id != NULL) { - g_free (instance->current_id); - instance->current_id = NULL; - save_current_view (instance); - gal_view_instance_changed(instance); - } - - gal_view_save (view, instance->custom_filename); -} - -static void -disconnect_view (GalViewInstance *instance) -{ - if (instance->current_view) { - if (instance->view_changed_id) { - gtk_signal_disconnect (GTK_OBJECT (instance->current_view), - instance->view_changed_id); - } - - gtk_object_unref (GTK_OBJECT (instance->current_view)); - } - g_free (instance->current_type); - g_free (instance->current_title); - instance->current_title = NULL; - instance->current_type = NULL; - instance->view_changed_id = 0; - instance->current_view = NULL; -} - -static void -connect_view (GalViewInstance *instance, GalView *view) -{ - if (instance->current_view) - disconnect_view (instance); - instance->current_view = view; - - instance->current_title = g_strdup (gal_view_get_title(view)); - instance->current_type = g_strdup (gal_view_get_type_code(view)); - instance->view_changed_id = - gtk_signal_connect(GTK_OBJECT(instance->current_view), "changed", - GTK_SIGNAL_FUNC(view_changed), instance); - - gal_view_instance_display_view (instance, instance->current_view); -} - -static void -gal_view_instance_destroy (GtkObject *object) -{ - GalViewInstance *instance = GAL_VIEW_INSTANCE(object); - - if (instance->collection) { - if (instance->collection_changed_id) { - gtk_signal_disconnect (GTK_OBJECT (instance->collection), - instance->collection_changed_id); - } - gtk_object_unref (GTK_OBJECT (instance->collection)); - } - - g_free (instance->instance_id); - g_free (instance->custom_filename); - g_free (instance->current_view_filename); - - g_free (instance->current_id); - disconnect_view (instance); - - g_free (instance->default_view); - - if (gal_view_instance_parent_class->destroy) - (*gal_view_instance_parent_class->destroy)(object); -} - -static void -gal_view_instance_class_init (GtkObjectClass *object_class) -{ - GalViewInstanceClass *klass = GAL_VIEW_INSTANCE_CLASS(object_class); - gal_view_instance_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = gal_view_instance_destroy; - - gal_view_instance_signals [DISPLAY_VIEW] = - gtk_signal_new ("display_view", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GalViewInstanceClass, display_view), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, GAL_VIEW_TYPE); - - gal_view_instance_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GalViewInstanceClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_instance_signals, LAST_SIGNAL); - - klass->display_view = NULL; - klass->changed = NULL; -} - -static void -gal_view_instance_init (GalViewInstance *instance) -{ - instance->collection = NULL; - - instance->instance_id = NULL; - instance->custom_filename = NULL; - instance->current_view_filename = NULL; - - instance->current_title = NULL; - instance->current_type = NULL; - instance->current_id = NULL; - instance->current_view = NULL; - - instance->view_changed_id = 0; - instance->collection_changed_id = 0; - - instance->loaded = FALSE; - instance->default_view = NULL; -} - -/** - * gal_view_instance_get_type: - * - */ -guint -gal_view_instance_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalViewInstance", - sizeof (GalViewInstance), - sizeof (GalViewInstanceClass), - (GtkClassInitFunc) gal_view_instance_class_init, - (GtkObjectInitFunc) gal_view_instance_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -collection_changed (GalView *view, GalViewInstance *instance) -{ - if (instance->current_id) { - char *view_id = instance->current_id; - instance->current_id = NULL; - gal_view_instance_set_current_view_id (instance, view_id); - g_free (view_id); - } -} - -static void -load_current_view (GalViewInstance *instance) -{ - xmlDoc *doc; - xmlNode *root; - GalView *view = NULL; - - doc = xmlParseFile(instance->current_view_filename); - - if (doc == NULL) { - instance->current_id = g_strdup (gal_view_instance_get_default_view (instance)); - - if (instance->current_id) { - int index = gal_view_collection_get_view_index_by_id (instance->collection, - instance->current_id); - - if (index != -1) { - view = gal_view_collection_get_view (instance->collection, - index); - view = gal_view_clone(view); - connect_view (instance, view); - } - } - return; - } - - root = xmlDocGetRootElement(doc); - instance->current_id = e_xml_get_string_prop_by_name_with_default (root, "current_view", NULL); - - if (instance->current_id != NULL) { - int index = gal_view_collection_get_view_index_by_id (instance->collection, - instance->current_id); - - if (index != -1) { - view = gal_view_collection_get_view (instance->collection, - index); - view = gal_view_clone(view); - } - } - if (view == NULL) { - char *type; - type = e_xml_get_string_prop_by_name_with_default (root, "current_view_type", NULL); - view = gal_view_collection_load_view_from_file (instance->collection, - type, - instance->custom_filename); - g_free (type); - } - - connect_view (instance, view); - - xmlFreeDoc(doc); -} - -/** - * gal_view_instance_new: - * @collection: This %GalViewCollection should be loaded before being passed to this function. - * @instance_id: Which instance of this type of object is this (for most of evo, this is the folder id.) - * - * Create a new %GalViewInstance. - * - * Return value: The new %GalViewInstance. - **/ -GalViewInstance * -gal_view_instance_new (GalViewCollection *collection, const char *instance_id) -{ - GalViewInstance *instance = gtk_type_new(gal_view_instance_get_type()); - if (gal_view_instance_construct (instance, collection, instance_id)) - return instance; - else { - gtk_object_unref (GTK_OBJECT (instance)); - return NULL; - } -} - -GalViewInstance * -gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *collection, const char *instance_id) -{ - char *filename; - char *safe_id; - - g_return_val_if_fail (gal_view_collection_loaded (collection), NULL); - - instance->collection = collection; - if (collection) - gtk_object_ref (GTK_OBJECT (collection)); - instance->collection_changed_id = - gtk_signal_connect (GTK_OBJECT (collection), "changed", - GTK_SIGNAL_FUNC (collection_changed), instance); - instance->instance_id = g_strdup (instance_id); - - safe_id = g_strdup (instance->instance_id); - e_filename_make_safe (safe_id); - - filename = g_strdup_printf ("custom_view-%s.xml", safe_id); - instance->custom_filename = g_concat_dir_and_file (instance->collection->local_dir, filename); - g_free (filename); - - filename = g_strdup_printf ("current_view-%s.xml", safe_id); - instance->current_view_filename = g_concat_dir_and_file (instance->collection->local_dir, filename); - g_free (filename); - - g_free (safe_id); - - return instance; -} - -/* Manipulate the current view. */ -char * -gal_view_instance_get_current_view_id (GalViewInstance *instance) -{ - if (instance->current_id && gal_view_collection_get_view_index_by_id (instance->collection, instance->current_id) != -1) - return g_strdup (instance->current_id); - else - return NULL; -} - -void -gal_view_instance_set_current_view_id (GalViewInstance *instance, const char *view_id) -{ - GalView *view; - int index; - - g_return_if_fail (instance != NULL); - g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance)); - - d(g_print("%s: view_id set to %s\n", __FUNCTION__, view_id)); - - if (instance->current_id && !strcmp (instance->current_id, view_id)) - return; - - g_free (instance->current_id); - instance->current_id = g_strdup (view_id); - - index = gal_view_collection_get_view_index_by_id (instance->collection, view_id); - if (index != -1) { - view = gal_view_collection_get_view (instance->collection, index); - connect_view (instance, gal_view_clone (view)); - } - - save_current_view (instance); - gal_view_instance_changed(instance); - gal_view_instance_display_view (instance, instance->current_view); -} - -GalView * -gal_view_instance_get_current_view (GalViewInstance *instance) -{ - return instance->current_view; -} - -void -gal_view_instance_set_custom_view (GalViewInstance *instance, GalView *view) -{ - g_free (instance->current_id); - instance->current_id = NULL; - - view = gal_view_clone (view); - connect_view (instance, view); - gal_view_save (view, instance->custom_filename); - save_current_view (instance); - gal_view_instance_changed(instance); -} - -static void -dialog_clicked(GtkWidget *dialog, int button, GalViewInstance *instance) -{ - if (button == 0) { - gal_view_instance_save_as_dialog_save (GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (dialog)); - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -void -gal_view_instance_save_as (GalViewInstance *instance) -{ - GtkWidget *dialog = gal_view_instance_save_as_dialog_new(instance); - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - GTK_SIGNAL_FUNC(dialog_clicked), instance); - gtk_widget_show(dialog); -} - -/* This is idempotent. Once it's been called once, the rest of the calls are ignored. */ -void -gal_view_instance_load (GalViewInstance *instance) -{ - if (!instance->loaded) { - load_current_view (instance); - instance->loaded = TRUE; - } -} - -/* These only mean anything before gal_view_instance_load is called the first time. */ -const char * -gal_view_instance_get_default_view (GalViewInstance *instance) -{ - if (instance->default_view) - return instance->default_view; - else - return gal_view_collection_get_default_view (instance->collection); -} - -void -gal_view_instance_set_default_view (GalViewInstance *instance, const char *id) -{ - g_free (instance->default_view); - instance->default_view = g_strdup (id); -} - -gboolean -gal_view_instance_exists (GalViewInstance *instance) -{ - struct stat st; - - if (instance->current_view_filename && stat (instance->current_view_filename, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) - return TRUE; - else - return FALSE; - -} - -typedef struct { - GalViewInstance *instance; - char *id; -} ListenerClosure; - -static void -view_item_cb (GtkWidget *widget, - gpointer user_data) -{ - ListenerClosure *closure = user_data; - - if (GTK_CHECK_MENU_ITEM (widget)->active) { - gal_view_instance_set_current_view_id (closure->instance, closure->id); - } -} - -static void -add_popup_radio_item (EPopupMenu *menu_item, - gchar *title, - void (*fn) (GtkWidget *widget, gpointer closure), - gpointer closure, - gboolean value) -{ - const EPopupMenu menu_item_struct = - E_POPUP_RADIO_ITEM_CC (title, - fn, - closure, - 0, - value); - - e_popup_menu_copy_1 (menu_item, &menu_item_struct); -} - -static void -add_popup_menu_item (EPopupMenu *menu_item, - gchar *title, - void (*fn) (GtkWidget *widget, gpointer closure), - gpointer closure) -{ - const EPopupMenu menu_item_struct = - E_POPUP_ITEM_CC (title, - fn, - closure, - 0); - - e_popup_menu_copy_1 (menu_item, &menu_item_struct); -} - -static void -define_views_dialog_clicked(GtkWidget *dialog, int button, GalViewInstance *instance) -{ - if (button == 0) { - gal_view_collection_save(instance->collection); - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -define_views_cb(GtkWidget *widget, - GalViewInstance *instance) -{ - GtkWidget *dialog = gal_define_views_dialog_new(instance->collection); - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - GTK_SIGNAL_FUNC(define_views_dialog_clicked), instance); - gtk_widget_show(dialog); -} - -static void -save_current_view_cb(GtkWidget *widget, - GalViewInstance *instance) -{ - gal_view_instance_save_as (instance); -} - -EPopupMenu * -gal_view_instance_get_popup_menu (GalViewInstance *instance) -{ - EPopupMenu *ret_val; - int length; - int i; - gboolean found = FALSE; - char *id; - - length = gal_view_collection_get_count(instance->collection); - id = gal_view_instance_get_current_view_id (instance); - - ret_val = g_new (EPopupMenu, length + 6); - - for (i = 0; i < length; i++) { - gboolean value = FALSE; - GalViewCollectionItem *item = gal_view_collection_get_view_item(instance->collection, i); - ListenerClosure *closure; - - closure = g_new (ListenerClosure, 1); - closure->instance = instance; - closure->id = item->id; - gtk_object_ref (GTK_OBJECT(closure->instance)); - - if (!found && id && !strcmp (id, item->id)) { - found = TRUE; - value = TRUE; - } - - add_popup_radio_item (ret_val + i, item->title, GTK_SIGNAL_FUNC (view_item_cb), closure, value); - } - - if (!found) { - e_popup_menu_copy_1 (ret_val + i++, &separator); - - add_popup_radio_item (ret_val + i++, N_("Custom View"), NULL, NULL, TRUE); - add_popup_menu_item (ret_val + i++, N_("Save Custom View"), GTK_SIGNAL_FUNC (save_current_view_cb), instance); - } - - e_popup_menu_copy_1 (ret_val + i++, &separator); - add_popup_menu_item (ret_val + i++, N_("Define Views"), GTK_SIGNAL_FUNC (define_views_cb), instance); - e_popup_menu_copy_1 (ret_val + i++, &terminator); - - return ret_val; -} - -void -gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu) -{ - int i; - /* This depends on the first non-custom closure to be a separator or a terminator. */ - for (i = 0; menu[i].name && *(menu[i].name); i++) { - gtk_object_unref (GTK_OBJECT ( ((ListenerClosure *)(menu[i].closure))->instance)); - g_free (menu[i].closure); - } - - e_popup_menu_free (menu); -} diff --git a/widgets/menus/gal-view-instance.h b/widgets/menus/gal-view-instance.h deleted file mode 100644 index 5e5ea6817e..0000000000 --- a/widgets/menus/gal-view-instance.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-instance.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_INSTANCE_H_ -#define _GAL_VIEW_INSTANCE_H_ - -#include -#include -#include -#include - -BEGIN_GNOME_DECLS - - -#define GAL_VIEW_INSTANCE_TYPE (gal_view_instance_get_type ()) -#define GAL_VIEW_INSTANCE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_INSTANCE_TYPE, GalViewInstance)) -#define GAL_VIEW_INSTANCE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_INSTANCE_TYPE, GalViewInstanceClass)) -#define GAL_IS_VIEW_INSTANCE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_INSTANCE_TYPE)) -#define GAL_IS_VIEW_INSTANCE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_INSTANCE_TYPE)) - -typedef struct { - GtkObject base; - - GalViewCollection *collection; - - char *instance_id; - char *current_view_filename; - char *custom_filename; - - char *current_title; - char *current_type; - char *current_id; - - GalView *current_view; - - guint view_changed_id; - guint collection_changed_id; - - guint loaded : 1; - char *default_view; -} GalViewInstance; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - void (*display_view) (GalViewInstance *instance, - GalView *view); - void (*changed) (GalViewInstance *instance); -} GalViewInstanceClass; - -/* Standard functions */ -GtkType gal_view_instance_get_type (void); - -/* */ -/*collection should be loaded when you call this. - instance_id: Which instance of this type of object is this (for most of evo, this is the folder id.) */ -GalViewInstance *gal_view_instance_new (GalViewCollection *collection, - const char *instance_id); -GalViewInstance *gal_view_instance_construct (GalViewInstance *instance, - GalViewCollection *collection, - const char *instance_id); - -/* Manipulate the current view. */ -char *gal_view_instance_get_current_view_id (GalViewInstance *instance); -void gal_view_instance_set_current_view_id (GalViewInstance *instance, - const char *view_id); -GalView *gal_view_instance_get_current_view (GalViewInstance *instance); - -/* Sets the current view to the given custom view. */ -void gal_view_instance_set_custom_view (GalViewInstance *instance, - GalView *view); - - -/* Returns true if this instance has ever been used before. */ -gboolean gal_view_instance_exists (GalViewInstance *instance); - -/* Manipulate the view collection */ -/* void gal_view_instance_set_as_default (GalViewInstance *instance); */ -void gal_view_instance_save_as (GalViewInstance *instance); - -/* This is idempotent. Once it's been called once, the rest of the calls are ignored. */ -void gal_view_instance_load (GalViewInstance *instance); - -/* These only mean anything before gal_view_instance_load is called the first time. */ -const char *gal_view_instance_get_default_view (GalViewInstance *instance); -void gal_view_instance_set_default_view (GalViewInstance *instance, - const char *id); - -EPopupMenu *gal_view_instance_get_popup_menu (GalViewInstance *instance); -void gal_view_instance_free_popup_menu (GalViewInstance *instance, - EPopupMenu *menu); - -END_GNOME_DECLS - - -#endif /* _GAL_VIEW_INSTANCE_H_ */ diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c deleted file mode 100644 index 41b4ea4c69..0000000000 --- a/widgets/menus/gal-view-new-dialog.c +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-new-dialog.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include -#include -#include "gal-view-new-dialog.h" -#include "gal-define-views-model.h" -#include -#include - -static void gal_view_new_dialog_init (GalViewNewDialog *card); -static void gal_view_new_dialog_class_init (GalViewNewDialogClass *klass); -static void gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gal_view_new_dialog_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, - ARG_NAME, - ARG_FACTORY -}; - -GtkType -gal_view_new_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "GalViewNewDialog", - sizeof (GalViewNewDialog), - sizeof (GalViewNewDialogClass), - (GtkClassInitFunc) gal_view_new_dialog_class_init, - (GtkObjectInitFunc) gal_view_new_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -gal_view_new_dialog_class_init (GalViewNewDialogClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = gal_view_new_dialog_set_arg; - object_class->get_arg = gal_view_new_dialog_get_arg; - object_class->destroy = gal_view_new_dialog_destroy; - - gtk_object_add_arg_type ("GalViewNewDialog::name", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_NAME); - gtk_object_add_arg_type ("GalViewNewDialog::factory", GTK_TYPE_OBJECT, - GTK_ARG_READABLE, ARG_FACTORY); -} - -static void -gal_view_new_dialog_init (GalViewNewDialog *dialog) -{ - GladeXML *gui; - GtkWidget *widget; - - gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-view-new-dialog.glade", NULL, PACKAGE); - dialog->gui = gui; - - widget = glade_xml_get_widget(gui, "table-top"); - if (!widget) { - return; - } - gtk_widget_ref(widget); - gtk_widget_unparent(widget); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); - - dialog->collection = NULL; - dialog->selected_factory = NULL; -} - -static void -gal_view_new_dialog_destroy (GtkObject *object) -{ - GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG(object); - - gtk_object_unref(GTK_OBJECT(gal_view_new_dialog->gui)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -GtkWidget* -gal_view_new_dialog_new (GalViewCollection *collection) -{ - GtkWidget *widget = - gal_view_new_dialog_construct(gtk_type_new (gal_view_new_dialog_get_type ()), - collection); - return widget; -} - - -static void -gal_view_new_dialog_select_row_callback(GtkCList *list, - gint row, - gint column, - GdkEventButton *event, - GalViewNewDialog *dialog) -{ - dialog->selected_factory = gtk_clist_get_row_data(list, - row); -} - -GtkWidget* -gal_view_new_dialog_construct (GalViewNewDialog *dialog, - GalViewCollection *collection) -{ - GtkWidget *list = glade_xml_get_widget(dialog->gui, - "clist-type-list"); - GList *iterator; - dialog->collection = collection; - - iterator = dialog->collection->factory_list; - - for ( ; iterator; iterator = g_list_next(iterator) ) { - GalViewFactory *factory = iterator->data; - char *text[1]; - int row; - - gtk_object_ref(GTK_OBJECT(factory)); - text[0] = (char *) gal_view_factory_get_title(factory); - row = gtk_clist_append(GTK_CLIST(list), text); - gtk_clist_set_row_data(GTK_CLIST(list), row, factory); - } - - gtk_signal_connect(GTK_OBJECT (list), - "select_row", - GTK_SIGNAL_FUNC(gal_view_new_dialog_select_row_callback), - dialog); - - return GTK_WIDGET(dialog); -} - -static void -gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (o); - - switch (arg_id){ - case ARG_NAME: - entry = glade_xml_get_widget(dialog->gui, "entry-name"); - if (entry && GTK_IS_EDITABLE(entry)) { - e_utf8_gtk_editable_set_text(GTK_EDITABLE(entry), GTK_VALUE_STRING(*arg)); - } - break; - default: - return; - } -} - -static void -gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (object); - - switch (arg_id) { - case ARG_NAME: - entry = glade_xml_get_widget(dialog->gui, "entry-name"); - if (entry && GTK_IS_EDITABLE(entry)) { - GTK_VALUE_STRING(*arg) = e_utf8_gtk_editable_get_text(GTK_EDITABLE(entry)); - } - break; - case ARG_FACTORY: - GTK_VALUE_OBJECT(*arg) = dialog->selected_factory ? GTK_OBJECT(dialog->selected_factory) : NULL; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/widgets/menus/gal-view-new-dialog.glade b/widgets/menus/gal-view-new-dialog.glade deleted file mode 100644 index 173fa6c3af..0000000000 --- a/widgets/menus/gal-view-new-dialog.glade +++ /dev/null @@ -1,220 +0,0 @@ - - - - - gal-view-new-dialog - gal-view-new-dialog - - src - pixmaps - C - True - True - True - False - False - False - True - - - - GnomeDialog - dialog1 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkTable - table-top - 4 - 1 - False - 6 - 6 - - 0 - True - True - - - - GtkLabel - label1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - entry-name - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - entry-name - True - True - True - 0 - - - 0 - 1 - 1 - 2 - 0 - 0 - True - False - False - False - True - True - - - - - GtkLabel - label2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 3 - 4 - 0 - 0 - False - True - False - False - True - True - - - - GtkCList - clist-type-list - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label5 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - - diff --git a/widgets/menus/gal-view-new-dialog.h b/widgets/menus/gal-view-new-dialog.h deleted file mode 100644 index 623cb341d0..0000000000 --- a/widgets/menus/gal-view-new-dialog.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-new-dialog.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __GAL_VIEW_NEW_DIALOG_H__ -#define __GAL_VIEW_NEW_DIALOG_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* GalViewNewDialog - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define GAL_VIEW_NEW_DIALOG_TYPE (gal_view_new_dialog_get_type ()) -#define GAL_VIEW_NEW_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialog)) -#define GAL_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialogClass)) -#define GAL_IS_VIEW_NEW_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE)) -#define GAL_IS_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE)) - -typedef struct _GalViewNewDialog GalViewNewDialog; -typedef struct _GalViewNewDialogClass GalViewNewDialogClass; - -struct _GalViewNewDialog -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - - GalViewCollection *collection; - GalViewFactory *selected_factory; -}; - -struct _GalViewNewDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkWidget *gal_view_new_dialog_new (GalViewCollection *collection); -GtkType gal_view_new_dialog_get_type (void); - -GtkWidget *gal_view_new_dialog_construct (GalViewNewDialog *dialog, - GalViewCollection *collection); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_VIEW_NEW_DIALOG_H__ */ diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c deleted file mode 100644 index cfaf5dabaa..0000000000 --- a/widgets/menus/gal-view.c +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include -#include -#include "gal-view.h" -#include "gal/util/e-util.h" - -#define GV_CLASS(e) ((GalViewClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type () - -#define d(x) - -d(static gint depth = 0;) - - -static GtkObjectClass *gal_view_parent_class; - -enum { - CHANGED, - LAST_SIGNAL -}; - -static guint gal_view_signals [LAST_SIGNAL] = { 0, }; - -/** - * gal_view_edit - * @view: The view to edit - */ -void -gal_view_edit (GalView *view) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->edit) - GV_CLASS (view)->edit (view); -} - -/** - * gal_view_load - * @view: The view to load to - * @filename: The file to load from - */ -void -gal_view_load (GalView *view, - const char *filename) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->load) - GV_CLASS (view)->load (view, filename); -} - -/** - * gal_view_save - * @view: The view to save - * @filename: The file to save to - */ -void -gal_view_save (GalView *view, - const char *filename) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->save) - GV_CLASS (view)->save (view, filename); -} - -/** - * gal_view_get_title - * @view: The view to query. - * - * Returns: The title of the view. - */ -const char * -gal_view_get_title (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->get_title) - return GV_CLASS (view)->get_title (view); - else - return NULL; -} - -/** - * gal_view_set_title - * @view: The view to set. - * @title: The new title value. - */ -void -gal_view_set_title (GalView *view, - const char *title) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - if (GV_CLASS (view)->set_title) - GV_CLASS (view)->set_title (view, title); -} - -/** - * gal_view_get_type_code - * @view: The view to get. - * - * Returns: The type of the view. - */ -const char * -gal_view_get_type_code (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->get_type_code) - return GV_CLASS (view)->get_type_code (view); - else - return NULL; -} - -/** - * gal_view_clone - * @view: The view to clone. - * - * Returns: The clone. - */ -GalView * -gal_view_clone (GalView *view) -{ - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW (view), NULL); - - if (GV_CLASS (view)->clone) - return GV_CLASS (view)->clone (view); - else - return NULL; -} - -/** - * gal_view_changed - * @view: The view that changed. - */ -void -gal_view_changed (GalView *view) -{ - g_return_if_fail (view != NULL); - g_return_if_fail (GAL_IS_VIEW (view)); - - gtk_signal_emit(GTK_OBJECT(view), - gal_view_signals [CHANGED]); -} - -static void -gal_view_class_init (GtkObjectClass *object_class) -{ - GalViewClass *klass = GAL_VIEW_CLASS(object_class); - gal_view_parent_class = gtk_type_class (PARENT_TYPE); - - klass->edit = NULL; - klass->load = NULL; - klass->save = NULL; - klass->get_title = NULL; - klass->clone = NULL; - - klass->changed = NULL; - - gal_view_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GalViewClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_signals, LAST_SIGNAL); -} - -GtkType -gal_view_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "GalView", - sizeof (GalView), - sizeof (GalViewClass), - (GtkClassInitFunc) gal_view_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h deleted file mode 100644 index 3d617df25f..0000000000 --- a/widgets/menus/gal-view.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _GAL_VIEW_H_ -#define _GAL_VIEW_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_VIEW_TYPE (gal_view_get_type ()) -#define GAL_VIEW(o) (GTK_CHECK_CAST ((o), GAL_VIEW_TYPE, GalView)) -#define GAL_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass)) -#define GAL_IS_VIEW(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_TYPE)) -#define GAL_IS_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE)) - -typedef struct { - GtkObject base; -} GalView; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Virtual methods - */ - void (*edit) (GalView *view); - void (*load) (GalView *view, - const char *filename); - void (*save) (GalView *view, - const char *filename); - const char *(*get_title) (GalView *view); - void (*set_title) (GalView *view, - const char *title); - const char *(*get_type_code) (GalView *view); - GalView *(*clone) (GalView *view); - - /* Signals */ - void (*changed) (GalView *view); -} GalViewClass; - -/* Standard functions */ -GtkType gal_view_get_type (void); - -/* Open an editor dialog for this view. */ -void gal_view_edit (GalView *view); - -/* xml load and save functions */ -void gal_view_load (GalView *view, - const char *filename); -void gal_view_save (GalView *view, - const char *filename); - -/* Title functions */ -const char *gal_view_get_title (GalView *view); -void gal_view_set_title (GalView *view, - const char *title); - -/* View type. */ -const char *gal_view_get_type_code (GalView *view); - -/* Cloning the view */ -GalView *gal_view_clone (GalView *view); - -/* Changed signal */ -void gal_view_changed (GalView *view); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _GAL_VIEW_H_ */ -- cgit v1.2.3