From 01cbdc713fe66ddf9b2f82c1562c8edc526b81d4 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 5 Dec 2001 04:54:00 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'GPERFMETER_GNOME_1_4_1'. svn path=/tags/GPERFMETER_GNOME_1_4_1/; revision=14882 --- widgets/menus/.cvsignore | 8 - widgets/menus/Makefile.am | 12 - widgets/menus/gal-define-views-dialog.c | 335 ----------------- 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 | 640 -------------------------------- widgets/menus/gal-view-collection.h | 117 ------ widgets/menus/gal-view-etable.c | 220 ----------- widgets/menus/gal-view-etable.h | 66 ---- 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-menus.c | 329 ---------------- widgets/menus/gal-view-menus.h | 36 -- 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 ----- 22 files changed, 3811 deletions(-) delete mode 100644 widgets/menus/.cvsignore delete mode 100644 widgets/menus/Makefile.am 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-menus.c delete mode 100644 widgets/menus/gal-view-menus.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/.cvsignore b/widgets/menus/.cvsignore deleted file mode 100644 index 7708c3d120..0000000000 --- a/widgets/menus/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -Makefile -libmenus.la -Makefile.in -.deps -.libs -.pure -*.o -*.lo diff --git a/widgets/menus/Makefile.am b/widgets/menus/Makefile.am deleted file mode 100644 index 7aeb243f52..0000000000 --- a/widgets/menus/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -noinst_LTLIBRARIES = libmenus.la - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/widgets/menus \ - $(EXTRA_GNOME_CFLAGS) \ - $(BONOBO_GNOME_CFLAGS) \ - -DG_LOG_DOMAIN=\"menus\" - -libmenus_la_SOURCES = \ - gal-view-menus.c \ - gal-view-menus.h diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c deleted file mode 100644 index 55588fd960..0000000000 --- a/widgets/menus/gal-define-views-dialog.c +++ /dev/null @@ -1,335 +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 -#include -#include "gal-define-views-dialog.h" -#include "gal-define-views-model.h" -#include "gal-view-new-dialog.h" -#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); - 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, 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); - - 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); - } -} - -/** - * 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 b393d97d2e..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 fe555ee5bd..0000000000 --- a/widgets/menus/gal-view-collection.c +++ /dev/null @@ -1,640 +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; - -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) - gtk_object_unref(GTK_OBJECT(item->view)); - g_free(item); -} - -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); - e_free_object_list(collection->factory_list); - - 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); - - g_free(collection->system_dir); - g_free(collection->local_dir); - - 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; -} - -/** - * 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()); -} - -/** - * 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); -} - -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; - - if (item->filename) { - GalViewFactory *factory; - GList *factories; - - factory = NULL; - for (factories = collection->factory_list; factories; factories = factories->next) { - if (item->type && !strcmp(gal_view_factory_get_type_code(factories->data), item->type)) { - factory = factories->data; - break; - } - } - if (factory) { - char *filename; - - filename = g_concat_dir_and_file(dir, item->filename); - item->view = gal_view_factory_new_view (factory, item->title); - gal_view_load(item->view, filename); - gal_view_set_title (item->view, item->title); - gtk_signal_connect(GTK_OBJECT(item->view), "changed", - GTK_SIGNAL_FUNC(view_changed), item); - g_free(filename); - } - - } - 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"); - - 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); - } - - 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); - - load_single_dir(collection, collection->local_dir, TRUE); - load_single_dir(collection, collection->system_dir, FALSE); -} - -/** - * 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); - - e_create_directory(collection->local_dir); - - doc = xmlNewDoc("1.0"); - root = xmlNewNode(NULL, "GalViewCollection"); - xmlDocSetRootElement(doc, root); - 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]; -} - -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; - - 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); - } -} - -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)); - - 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 *)); - 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; - - 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); -} diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h deleted file mode 100644 index 9df00557cd..0000000000 --- a/widgets/menus/gal-view-collection.h +++ /dev/null @@ -1,117 +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 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#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; - - char *system_dir; - char *local_dir; -} 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; - gboolean changed; - gboolean ever_changed; - gboolean built_in; - char *filename; - char *title; - char *type; - GalViewCollection *collection; -}; - -/* Standard functions */ -GtkType gal_view_collection_get_type (void); -GalViewCollection *gal_view_collection_new (void); - -/* Set up the view collection */ -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. */ -void gal_view_collection_display_view (GalViewCollection *collection, - GalView *view); -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); - -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); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#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 24d9815034..0000000000 --- a/widgets/menus/gal-view-etable.c +++ /dev/null @@ -1,220 +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 -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); - 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; -} - -/** - * 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); -} - -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; -} diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h deleted file mode 100644 index 8d340c4069..0000000000 --- a/widgets/menus/gal-view-etable.h +++ /dev/null @@ -1,66 +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 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#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; -} 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); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#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 90864fda8f..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-menus.c b/widgets/menus/gal-view-menus.c deleted file mode 100644 index 2b2677a5bd..0000000000 --- a/widgets/menus/gal-view-menus.c +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * gal-view-menus.c: Deploy a GalViewCollection in the menus. - * - * Author: - * Chris Lahey - * - * (C) 2000, 2001 Ximian, Inc. - */ -#include - -#include "gal-view-menus.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct _GalViewMenusPrivate { - GalViewCollection *collection; - int collection_changed_id; - BonoboUIVerb *verbs; - BonoboUIComponent *component; -}; - -#define PARENT_TYPE (gtk_object_get_type()) - -static GtkObjectClass *gvm_parent_class; -static void collection_changed (GalViewCollection *collection, - GalViewMenus *gvm); - -#define d(x) - -typedef struct { - GalViewCollection *collection; - GalView *view; -} CollectionAndView; - -static void -free_verbs (GalViewMenus *gvm) -{ - BonoboUIVerb *verbs; - if (gvm->priv->verbs) { - for (verbs = gvm->priv->verbs + 1; verbs->cname; verbs++) { - CollectionAndView *cnv; - - if (gvm->priv->component) - bonobo_ui_component_remove_verb(gvm->priv->component, verbs->cname); - - cnv = verbs->user_data; - g_free(verbs->cname); - - gtk_object_unref(GTK_OBJECT(cnv->collection)); - gtk_object_unref(GTK_OBJECT(cnv->view)); - g_free(cnv); - } - g_free(gvm->priv->verbs); - } - gvm->priv->verbs = NULL; -} - -static void -remove_xml (GalViewMenus *gvm) -{ -} - -static void -gvm_destroy (GtkObject *object) -{ - GalViewMenus *gvm = GAL_VIEW_MENUS (object); - - if (gvm->priv->collection && gvm->priv->collection_changed_id != 0) { - gtk_signal_disconnect(GTK_OBJECT(gvm->priv->collection), gvm->priv->collection_changed_id); - gvm->priv->collection_changed_id = 0; - } - - if (gvm->priv->collection) - gtk_object_unref(GTK_OBJECT(gvm->priv->collection)); - - free_verbs(gvm); - remove_xml(gvm); - - if (gvm->priv->component) { - bonobo_object_unref (BONOBO_OBJECT (gvm->priv->component)); - gvm->priv->component = NULL; - } - - g_free(gvm->priv); - gvm->priv = NULL; - - GTK_OBJECT_CLASS (gvm_parent_class)->destroy (object); -} - -static void -gvm_class_init (GtkObjectClass *klass) -{ - gvm_parent_class = gtk_type_class (PARENT_TYPE); - - klass->destroy = gvm_destroy; -} - -static void -gvm_init (GalViewMenus *gvm) -{ - gvm->priv = g_new(GalViewMenusPrivate, 1); - gvm->priv->collection = NULL; - gvm->priv->collection_changed_id = 0; - gvm->priv->verbs = NULL; - gvm->priv->component = NULL; -} - -E_MAKE_TYPE(gal_view_menus, "GalViewMenus", GalViewMenus, gvm_class_init, gvm_init, PARENT_TYPE); - -GalViewMenus * -gal_view_menus_new (GalViewCollection *collection) -{ - GalViewMenus *gvm; - - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - - gvm = gtk_type_new (GAL_VIEW_MENUS_TYPE); - gal_view_menus_construct(gvm, collection); - - return gvm; -} - -GalViewMenus * -gal_view_menus_construct (GalViewMenus *gvm, - GalViewCollection *collection) -{ - g_return_val_if_fail (gvm != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_MENUS (gvm), NULL); - g_return_val_if_fail (collection != NULL, NULL); - g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); - - gtk_object_ref(GTK_OBJECT(collection)); - gvm->priv->collection = collection; - gvm->priv->collection_changed_id = gtk_signal_connect ( - GTK_OBJECT(collection), "changed", - GTK_SIGNAL_FUNC(collection_changed), gvm); - - return gvm; -} - -static void -dialog_clicked(GtkWidget *dialog, int button, GalViewMenus *menus) -{ - if (button == 0) { - gal_view_collection_save(menus->priv->collection); - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -define_views(BonoboUIComponent *component, - GalViewMenus *menus, - char *cname) -{ - GtkWidget *dialog = gal_define_views_dialog_new(menus->priv->collection); - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - GTK_SIGNAL_FUNC(dialog_clicked), menus); - gtk_widget_show(dialog); -} - -static char * -build_menus(GalViewMenus *menus) -{ - BonoboUINode *root, *menu, *submenu, *place, *menuitem; - char *xml; - xmlChar *string; - int length; - int i; - GalViewCollection *collection = menus->priv->collection; - - root = bonobo_ui_node_new("Root"); - menu = bonobo_ui_node_new_child(root, "menu"); - - submenu = bonobo_ui_node_new_child(menu, "submenu"); - bonobo_ui_node_set_attr(submenu, "name", "View"); - - place = bonobo_ui_node_new_child(submenu, "placeholder"); - bonobo_ui_node_set_attr(place, "name", "ViewBegin"); - - submenu = bonobo_ui_node_new_child(place, "submenu"); - bonobo_ui_node_set_attr(submenu, "name", "CurrentView"); - bonobo_ui_node_set_attr(submenu, "_label", N_("_Current View")); - - length = gal_view_collection_get_count(collection); - for (i = 0; i < length; i++) { - char *label, *encoded_label; - char *verb; - GalViewCollectionItem *item = gal_view_collection_get_view_item(collection, i); - menuitem = bonobo_ui_node_new_child(submenu, "menuitem"); - bonobo_ui_node_set_attr(menuitem, "name", item->id); - - /* bonobo displays this string so it must be in locale */ - label = e_utf8_to_locale_string(item->title); - encoded_label = bonobo_ui_util_encode_str (label); - bonobo_ui_node_set_attr(menuitem, "label", encoded_label); - g_free (encoded_label); - g_free(label); - - verb = g_strdup_printf("DefineViews:%s", item->id); - bonobo_ui_node_set_attr(menuitem, "verb", verb); - g_free(verb); - } - -#if 0 - menuitem = bonobo_ui_node_new_child(submenu, "separator"); - - menuitem = bonobo_ui_node_new_child(submenu, "menuitem"); - bonobo_ui_node_set_attr(menuitem, "name", "DefineViews"); - bonobo_ui_node_set_attr(menuitem, "_label", N_("Define Views")); - bonobo_ui_node_set_attr(menuitem, "verb", "DefineViews"); -#endif - - string = bonobo_ui_node_to_string(root, TRUE); - xml = g_strdup(string); - bonobo_ui_node_free_string(string); - - bonobo_ui_node_free(root); - - d(g_print (xml)); - - return xml; -} - -static void -show_view(BonoboUIComponent *component, - gpointer user_data, - const char *cname) -{ - CollectionAndView *cnv = user_data; - gal_view_collection_display_view(cnv->collection, cnv->view); -} - -static BonoboUIVerb * -build_verbs (GalViewMenus *menus) -{ - GalViewCollection *collection = menus->priv->collection; - int count = gal_view_collection_get_count(collection); - BonoboUIVerb *verbs = g_new(BonoboUIVerb, count + 2); - BonoboUIVerb *verb; - int i; - - verb = verbs; - verb->cname = g_strdup("DefineViews"); - verb->cb = (BonoboUIVerbFn) define_views; - verb->user_data = menus; - verb->dummy = NULL; - verb ++; - for (i = 0; i < count; i++) { - CollectionAndView *cnv; - GalViewCollectionItem *item = gal_view_collection_get_view_item(collection, i); - - cnv = g_new(CollectionAndView, 1); - cnv->view = item->view; - cnv->collection = collection; - - gtk_object_ref(GTK_OBJECT(cnv->view)); - gtk_object_ref(GTK_OBJECT(cnv->collection)); - - verb->cname = g_strdup_printf("DefineViews:%s", item->id); - verb->cb = show_view; - verb->user_data = cnv; - verb->dummy = NULL; - verb++; - } - - verb->cname = NULL; - verb->cb = NULL; - verb->user_data = NULL; - verb->dummy = NULL; - verb++; - - return verbs; -} - -static void -build_stuff (GalViewMenus *gvm, - CORBA_Environment *ev) -{ - char *xml; - - remove_xml(gvm); - xml = build_menus(gvm); - bonobo_ui_component_set_translate(gvm->priv->component, "/", xml, ev); - g_free(xml); - - free_verbs(gvm); - gvm->priv->verbs = build_verbs(gvm); - bonobo_ui_component_add_verb_list(gvm->priv->component, gvm->priv->verbs); -} - -void -gal_view_menus_apply (GalViewMenus *gvm, - BonoboUIComponent *component, - CORBA_Environment *ev) -{ - if (component) - bonobo_object_ref (BONOBO_OBJECT (component)); - - if (gvm->priv->component) - bonobo_object_unref (BONOBO_OBJECT (gvm->priv->component)); - - gvm->priv->component = component; - - build_stuff (gvm, ev); -} - -static void -collection_changed (GalViewCollection *collection, - GalViewMenus *gvm) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - build_stuff(gvm, &ev); - CORBA_exception_free (&ev); -} diff --git a/widgets/menus/gal-view-menus.h b/widgets/menus/gal-view-menus.h deleted file mode 100644 index bc62d82f54..0000000000 --- a/widgets/menus/gal-view-menus.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _GAL_VIEW_MENUS_H_ -#define _GAL_VIEW_MENUS_H_ - -#include -#include -#include -#include - -#define GAL_VIEW_MENUS_TYPE (gal_view_menus_get_type ()) -#define GAL_VIEW_MENUS(o) (GTK_CHECK_CAST ((o), GAL_VIEW_MENUS_TYPE, GalViewMenus)) -#define GAL_VIEW_MENUS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_MENUS_TYPE, GalViewMenusClass)) -#define GAL_IS_VIEW_MENUS(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_MENUS_TYPE)) -#define GAL_IS_VIEW_MENUS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_MENUS_TYPE)) - -typedef struct _GalViewMenusPrivate GalViewMenusPrivate; - -typedef struct { - GtkObject base; - GalViewMenusPrivate *priv; -} GalViewMenus; - -typedef struct { - GtkObjectClass parent_class; -} GalViewMenusClass; - -GtkType gal_view_menus_get_type (void); -GalViewMenus *gal_view_menus_new (GalViewCollection *collection); -GalViewMenus *gal_view_menus_construct (GalViewMenus *menus, - GalViewCollection *collection); - -void gal_view_menus_apply (GalViewMenus *menus, - BonoboUIComponent *component, - CORBA_Environment *ev); - -#endif /* _GAL_VIEW_MENUS_H_ */ diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c deleted file mode 100644 index 417fa7c343..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 71cf0d3fdd..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