aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-12 17:33:12 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-12 17:33:12 +0800
commit28e03809224f5d850e8b8ba16253f73968b93e2e (patch)
treed50d427b7560336ecb8b42d422693242f336f3b5
parent1fc94a31fa32251b9371cd1e643422a403ebc52c (diff)
downloadgsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar.gz
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar.bz2
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar.lz
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar.xz
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.tar.zst
gsoc2013-evolution-28e03809224f5d850e8b8ba16253f73968b93e2e.zip
Made this into a Gtk object.
2000-08-12 Christopher James Lahey <clahey@helixcode.com> * gui/search/e-addressbook-search-dialog.c, gui/search/e-addressbook-search-dialog.h: Made this into a Gtk object. svn path=/trunk/; revision=4772
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.c168
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.h63
3 files changed, 218 insertions, 19 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 31061654ac..1c4d1a583d 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,11 @@
2000-08-12 Christopher James Lahey <clahey@helixcode.com>
+ * gui/search/e-addressbook-search-dialog.c,
+ gui/search/e-addressbook-search-dialog.h: Made this into a Gtk
+ object.
+
+2000-08-12 Christopher James Lahey <clahey@helixcode.com>
+
* backend/pas/pas-book-view.c: Ref our book view listener.
* gui/component/addressbook.c: Updated to use new minicard view
diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c
index a7e0f0e1a8..c25187f0b4 100644
--- a/addressbook/gui/search/e-addressbook-search-dialog.c
+++ b/addressbook/gui/search/e-addressbook-search-dialog.c
@@ -1,10 +1,97 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * e-addressbook-search-dialog.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.
+ */
-struct _EAddressBookSearchDialog {
- GtkWidget *search;
- GtkWidget *view;
+#include <config.h>
+#include <gnome.h>
+#include <e-util/e-canvas.h>
+#include "e-addressbook-search-dialog.h"
+#include "e-minicard-view-widget.h"
+static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget);
+static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass);
+static void e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_addressbook_search_dialog_destroy (GtkObject *object);
+
+static ECanvasClass *parent_class = NULL;
+
+#define PARENT_TYPE (gnome_dialog_get_type())
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_BOOK,
};
+GtkType
+e_addressbook_search_dialog_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type)
+ {
+ static const GtkTypeInfo info =
+ {
+ "EAddressbookSearchDialog",
+ sizeof (EAddressbookSearchDialog),
+ sizeof (EAddressbookSearchDialogClass),
+ (GtkClassInitFunc) e_addressbook_search_dialog_class_init,
+ (GtkObjectInitFunc) e_addressbook_search_dialog_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ type = gtk_type_unique (PARENT_TYPE, &info);
+ }
+
+ return type;
+}
+
+static void
+e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass)
+{
+ GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ ECanvasClass *canvas_class;
+
+ object_class = (GtkObjectClass*) klass;
+ widget_class = GTK_WIDGET_CLASS (klass);
+ canvas_class = E_CANVAS_CLASS (klass);
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ gtk_object_add_arg_type ("EAddressbookSearchDialog::book", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_BOOK);
+
+ object_class->set_arg = e_addressbook_search_dialog_set_arg;
+ object_class->get_arg = e_addressbook_search_dialog_get_arg;
+ object_class->destroy = e_addressbook_search_dialog_destroy;
+
+ widget_class->realize = e_addressbook_search_dialog_realize;
+ widget_class->size_allocate = e_addressbook_search_dialog_size_allocate;
+
+ canvas_class->reflow = e_addressbook_search_dialog_reflow;
+}
+
static void
button_press (GtkWidget *widget, EAddressBookSearchDialog *dialog)
{
@@ -17,30 +104,73 @@ button_press (GtkWidget *widget, EAddressBookSearchDialog *dialog)
g_free(query);
}
-GtkWidget *
-get_addressbook_search_dialog(EBook *book)
+static void
+e_addressbook_search_dialog_init (EAddressbookSearchDialog *view)
{
- GtkWidget *vbox;
- GtkWidget *search;
GtkWidget *search_button;
- GtkWidget *view;
-
- vbox = gtk_vbox_new(FALSE, 0);
+ GnomeDialog *dialog = GNOME_DIALOG (view);
- search = get_widget();
- gtk_box_pack_start(GTK_BOX(vbox), search, TRUE, TRUE, 0);
- gtk_widget_show(search);
+ view->search = get_widget();
+ gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, TRUE, TRUE, 0);
+ gtk_widget_show(view->search);
button = gtk_button_new_with_label(_("Search"));
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(dialog->vbox), button, FALSE, FALSE, 0);
gtk_widget_show(button);
- view = e_minicard_view_widget_new();
- gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 0);
- gtk_object_set(GTK_OBJECT(dialog->view),
+ view->view = e_minicard_view_widget_new();
+ gtk_box_pack_start(GTK_BOX(dialog->vbox), view->view, TRUE, TRUE, 0);
+}
+
+GtkWidget *
+e_addressbook_search_dialog_new (EBook *book)
+{
+ EAddressbookSearchDialog *view = gtk_type_new (e_addressbook_search_dialog_get_type ());
+ gtk_object_set(GTK_OBJECT(view->view),
"book", book,
NULL);
+ return GTK_WIDGET(view);
+}
+
+static void
+e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+{
+ EAddressbookSearchDialog *emvw;
+
+ emvw = E_ADDRESSBOOK_SEARCH_DIALOG (o);
+
+ switch (arg_id){
+ case ARG_BOOK:
+ gtk_object_set(GTK_OBJECT(view->view),
+ "book", GTK_VALUE_OBJECT (*arg),
+ NULL);
+ break;
+ }
+}
+
+static void
+e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ EAddressbookSearchDialog *emvw;
+
+ emvw = E_ADDRESSBOOK_SEARCH_DIALOG (object);
+
+ switch (arg_id) {
+ case ARG_BOOK:
+ gtk_object_get(GTK_OBJECT(view->view),
+ "book", &(GTK_VALUE_OBJECT (*arg)),
+ NULL);
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+static void
+e_addressbook_search_dialog_destroy (GtkObject *object)
+{
+ EAddressbookSearchDialog *view = E_ADDRESSBOOK_SEARCH_DIALOG(object);
- gtk_widget_show(vbox);
- return vbox;
+ GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h
new file mode 100644
index 0000000000..51ef350afa
--- /dev/null
+++ b/addressbook/gui/search/e-addressbook-search-dialog.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-minicard-view-widget.h
+ * Copyright (C) 2000 Helix Code, Inc.
+ * Author: Chris Lahey <clahey@helixcode.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 __E_ADDRESSBOOK_SEARCH_DIALOG_H__
+#define __E_ADDRESSBOOK_SEARCH_DIALOG_H__
+
+#include <gnome.h>
+#include <ebook/e-book.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_ADDRESSBOOK_SEARCH_DIALOG_TYPE (e_addressbook_search_dialog_get_type ())
+#define E_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialog))
+#define E_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialogClass))
+#define E_IS_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE))
+#define E_IS_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE))
+
+
+typedef struct _EAddressbookSearchDialog EAddressbookSearchDialog;
+typedef struct _EAddressbookSearchDialogClass EAddressbookSearchDialogClass;
+
+struct _EAddressbookSearchDialog
+{
+ GnomeDialog parent;
+
+ GtkWidget *search;
+ GtkWidget *view;
+};
+
+struct _EAddressbookSearchDialogClass
+{
+ GnomeDialogClass parent_class;
+};
+
+GtkType e_addressbook_search_dialog_get_type (void);
+
+GtkWidget *e_addressbook_search_dialog_new (EBook *book);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __E_ADDRESSBOOK_SEARCH_DIALOG_H__ */