aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-10 19:53:46 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-10 19:53:46 +0800
commit6cb08f0bc177cd0de35b852fac94a181f4d2233c (patch)
tree5a83d501fe75db56369872745834981ec460a06b
parent317000107d2209d45c60a2241f1e69cb6cd2489d (diff)
downloadgsoc2013-evolution-6cb08f0bc177cd0de35b852fac94a181f4d2233c.tar.gz
gsoc2013-evolution-6cb08f0bc177cd0de35b852fac94a181f4d2233c.tar.zst
gsoc2013-evolution-6cb08f0bc177cd0de35b852fac94a181f4d2233c.zip
some test files
svn path=/trunk/; revision=1101
-rw-r--r--ChangeLog7
-rw-r--r--camel/camel-folder.c15
-rw-r--r--camel/camel-folder.h5
-rw-r--r--camel/providers/MH/camel-mh-folder.c66
-rw-r--r--configure.in20
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/ui-tests/Makefile.am16
-rw-r--r--tests/ui-tests/store_listing.c54
-rw-r--r--tests/ui-tests/store_listing.glade289
9 files changed, 469 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 51c20cec72..5614dc0501 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-08-10 root <guiheneu@jean.joudboeuf.fr>
+
+ * camel/camel-folder.c (camel_folder_append_message):
+ new method.
+
1999-08-09 bertrand <Bertrand.Guiheneuf@aful.org>
* devel-docs/misc/ref_and_id_proposition.txt:
@@ -90,7 +95,7 @@
* camel/providers/MH/camel-mh-store.c:
parent class is CamelStorClass not GtkObjectClass
-1999-08-05
+1999-08-05 bertrand <Bertrand.Guiheneuf@aful.org>
* tests/test4.c:
test mh provider.
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 5fa22a5b72..2d0a29faab 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -51,6 +51,8 @@ static GList *_list_subfolders (CamelFolder *folder);
static GList *_expunge (CamelFolder *folder);
static CamelMimeMessage *_get_message (CamelFolder *folder, gint number);
static gint _get_message_count (CamelFolder *folder);
+static gint _append_message (CamelFolder *folder, CamelMimeMessage *message);
+
static void
camel_folder_class_init (CamelFolderClass *camel_folder_class)
@@ -78,6 +80,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->expunge = _expunge;
camel_folder_class->get_message = _get_message;
camel_folder_class->get_message_count = _get_message_count;
+ camel_folder_class->append_message = _append_message;
/* virtual method overload */
}
@@ -784,3 +787,15 @@ camel_folder_get_message_count (CamelFolder *folder)
return CF_CLASS (folder)->get_message_count (folder);
}
+
+static gint
+_append_message (CamelFolder *folder, CamelMimeMessage *message)
+{
+ return -1;
+}
+
+
+gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message)
+{
+ return CF_CLASS (folder)->append_message (folder, message);
+}
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index b678631eea..e980e39e15 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -100,7 +100,7 @@ typedef struct {
GList * (*expunge) (CamelFolder *folder);
CamelMimeMessage * (*get_message) (CamelFolder *folder, gint number);
gint (*get_message_count) (CamelFolder *folder);
-
+ gint (*append_message) (CamelFolder *folder, CamelMimeMessage *message);
} CamelFolderClass;
@@ -125,7 +125,8 @@ const gchar *camel_folder_get_name (CamelFolder *folder);
const gchar *camel_folder_get_full_name (CamelFolder *folder);
CamelMimeMessage *camel_folder_get_message (CamelFolder *folder, gint number);
gboolean camel_folder_exists (CamelFolder *folder);
-gint camel_get_message_count (CamelFolder *folder);
+gint camel_folder_get_message_count (CamelFolder *folder);
+gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message);
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
index 2e19349e67..a1c78fd309 100644
--- a/camel/providers/MH/camel-mh-folder.c
+++ b/camel/providers/MH/camel-mh-folder.c
@@ -51,6 +51,8 @@ static gboolean _delete_messages (CamelFolder *folder);
static GList *_list_subfolders (CamelFolder *folder);
static CamelMimeMessage *_get_message (CamelFolder *folder, gint number);
static gint _get_message_count (CamelFolder *folder);
+static gint _append_message (CamelFolder *folder, CamelMimeMessage *message);
+
static void
camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
@@ -69,6 +71,7 @@ camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
camel_folder_class->list_subfolders = _list_subfolders;
camel_folder_class->get_message = _get_message;
camel_folder_class->get_message_count = _get_message_count;
+ camel_folder_class->append_message = _append_message;
}
@@ -480,3 +483,66 @@ _get_message_count (CamelFolder *folder)
closedir (dir_handle);
return message_count;
}
+
+
+
+
+static gint
+_append_message (CamelFolder *folder, CamelMimeMessage *message)
+{
+ CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
+ const gchar *directory_path;
+ struct dirent *dir_entry;
+ DIR *dir_handle;
+ guint last_max_message_number = 0;
+ guint current_message_number;
+ guint new_message_number;
+ gchar *new_message_filename;
+ CamelStream *output_stream;
+ gboolean error;
+
+ CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::append_message\n");
+
+ g_assert(folder);
+
+ directory_path = mh_folder->directory_path;
+ if (!directory_path) return -1;
+
+ if (!camel_folder_exists (folder)) return 0;
+
+ dir_handle = opendir (directory_path);
+
+ /* read first entry in the directory */
+ dir_entry = readdir (dir_handle);
+ while (dir_entry != NULL) {
+ /* tests if the entry correspond to a message file */
+ if (_is_a_message_file (dir_entry->d_name, directory_path)) {
+ /* see if the message number is the biggest found */
+ current_message_number = atoi (dir_entry->d_name);
+ if (current_message_number > last_max_message_number)
+ last_max_message_number = current_message_number;
+ }
+ /* read next entry */
+ dir_entry = readdir (dir_handle);
+ }
+ closedir (dir_handle);
+
+ new_message_number = last_max_message_number + 1;
+ new_message_filename = g_strdup_printf ("%s/%d", directory_path, new_message_number);
+ CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::append_message new message path is %s\n", new_message_filename);
+
+ output_stream = camel_stream_fs_new_with_name (new_message_filename, CAMEL_STREAM_FS_WRITE);
+ if (output_stream != NULL) {
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
+ camel_stream_close (output_stream);
+ } else {
+ CAMEL_LOG_WARNING ("CamelMhFolder::append_message could not open %s for writing\n", new_message_filename);
+ CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
+ error = TRUE;
+ }
+
+ g_free (new_message_filename);
+ CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::append_message\n");
+ if (error) return -1;
+ else return new_message_number;
+}
diff --git a/configure.in b/configure.in
index 975e83f867..93f6553fac 100644
--- a/configure.in
+++ b/configure.in
@@ -58,6 +58,25 @@ dnl have_bonobo=false
dnl ])
dnl AM_CONDITIONAL(BONOBO, $have_bonobo)
+
+
+
+dnl ******************************
+dnl LibGlade checking
+dnl ******************************
+AC_MSG_CHECKING(For Glade libraries)
+if gnome-config --libs libglade > /dev/null 2>&1; then
+ AC_MSG_RESULT(found)
+else
+ AC_MSG_ERROR(Did not find libGlade installed)
+fi
+
+EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui libglade `
+EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui libglade `
+AC_SUBST(EXTRA_GNOME_LIBS)
+AC_SUBST(EXTRA_GNOME_CFLAGS)
+
+
AC_ARG_WITH(camel-hard-log-level, [ --with-camel-hard-log-level=level value of log level in camel (0-10)],
camel_hard_log_level="$withval", camel_hard_log_level="0")
AC_DEFINE_UNQUOTED(CAMEL_HARD_LOG_LEVEL, $camel_hard_log_level)
@@ -72,4 +91,5 @@ camel/providers/MH/Makefile
devel-docs/Makefile
devel-docs/camel/Makefile
tests/Makefile
+tests/ui-tests/Makefile
])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3e8f4de850..55ef5048dd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,7 +2,6 @@
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
-I$(includedir) -I$(top_srcdir)/camel/providers/MH
-
LDADD = \
$(top_builddir)/camel/libcamel.la \
$(GNOME_LIBDIR) \
diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am
new file mode 100644
index 0000000000..19bbb6c8d4
--- /dev/null
+++ b/tests/ui-tests/Makefile.am
@@ -0,0 +1,16 @@
+# process this file with automake to create Makefile.in
+
+INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
+ -I$(includedir) -I$(top_srcdir)/camel/providers/MH \
+ $(EXTRA_GNOME_CFLAGS)
+
+LDADD = \
+ $(top_builddir)/camel/libcamel.la \
+ $(INTLLIBS) $(EXTRA_GNOME_LIBS)
+
+
+
+
+
+noinst_PROGRAMS = \
+ store_listing \ No newline at end of file
diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c
new file mode 100644
index 0000000000..1eee741286
--- /dev/null
+++ b/tests/ui-tests/store_listing.c
@@ -0,0 +1,54 @@
+/* Bertrand.Guiheneuf@aful.org */
+
+
+
+/*
+ gcc -o store_listing `gnome-config --cflags gnomeui libglade` \
+ store_listing.c `gnome-config --libs gnomeui libglade`
+*/
+/******************************************************************************/
+
+
+#include <gnome.h>
+#include <glade/glade.h>
+
+
+static GladeXML *xml;
+
+
+void
+on_exit1_activate (GtkWidget *widget, void *data)
+{
+ gtk_main_quit ();
+}
+
+
+void
+on_about1_activate (GtkWidget *widget, void *data)
+{
+ GtkWidget *about_widget;
+
+ about_widget = glade_xml_get_widget (xml, "about_widget");
+ gtk_widget_show (about_widget);
+}
+
+
+
+
+int
+main(int argc, char *argv[])
+{
+
+ gnome_init ("store_listing", "1.0", argc, argv);
+
+ glade_gnome_init();
+
+ xml = glade_xml_new ("store_listing.glade", NULL);
+ if (xml) glade_xml_signal_autoconnect (xml);
+
+
+ gtk_main ();
+
+ return 0;
+}
+
diff --git a/tests/ui-tests/store_listing.glade b/tests/ui-tests/store_listing.glade
new file mode 100644
index 0000000000..32516494aa
--- /dev/null
+++ b/tests/ui-tests/store_listing.glade
@@ -0,0 +1,289 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>store_listing</name>
+ <program_name>store_listing</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <use_widget_names>False</use_widget_names>
+ <output_main_file>True</output_main_file>
+ <output_support_files>True</output_support_files>
+ <output_build_files>True</output_build_files>
+ <backup_source_files>True</backup_source_files>
+ <main_source_file>interface.c</main_source_file>
+ <main_header_file>interface.h</main_header_file>
+ <handler_source_file>callbacks.c</handler_source_file>
+ <handler_header_file>callbacks.h</handler_header_file>
+ <support_source_file>support.c</support_source_file>
+ <support_header_file>support.h</support_header_file>
+ <translatable_strings_file></translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomeApp</class>
+ <name>app1</name>
+ <width>600</width>
+ <height>400</height>
+ <title>store_listing</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <enable_layout_config>True</enable_layout_config>
+
+ <widget>
+ <class>GnomeDock</class>
+ <child_name>GnomeApp:dock</child_name>
+ <name>dock1</name>
+ <allow_floating>True</allow_floating>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GnomeDockItem</class>
+ <name>dockitem1</name>
+ <border_width>2</border_width>
+ <placement>GNOME_DOCK_TOP</placement>
+ <band>0</band>
+ <position>0</position>
+ <offset>0</offset>
+ <locked>False</locked>
+ <exclusive>True</exclusive>
+ <never_floating>False</never_floating>
+ <never_vertical>True</never_vertical>
+ <never_horizontal>False</never_horizontal>
+ <shadow_type>GTK_SHADOW_OUT</shadow_type>
+
+ <widget>
+ <class>GtkMenuBar</class>
+ <name>menubar1</name>
+ <shadow_type>GTK_SHADOW_NONE</shadow_type>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>file1</name>
+ <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>file1_menu</name>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>new_store</name>
+ <signal>
+ <name>activate</name>
+ <handler>on_new_store_activate</handler>
+ <last_modification_time>Tue, 10 Aug 1999 10:29:12 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_NEW_ITEM</stock_item>
+ <label>_New store</label>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>separator1</name>
+ <right_justify>False</right_justify>
+ </widget>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>exit1</name>
+ <signal>
+ <name>activate</name>
+ <handler>on_exit1_activate</handler>
+ <last_modification_time>Tue, 10 Aug 1999 10:25:52 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>help1</name>
+ <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>help1_menu</name>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>about1</name>
+ <signal>
+ <name>activate</name>
+ <handler>on_about1_activate</handler>
+ <last_modification_time>Tue, 10 Aug 1999 10:25:52 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDockItem</class>
+ <name>dockitem2</name>
+ <border_width>1</border_width>
+ <placement>GNOME_DOCK_TOP</placement>
+ <band>1</band>
+ <position>0</position>
+ <offset>0</offset>
+ <locked>False</locked>
+ <exclusive>True</exclusive>
+ <never_floating>False</never_floating>
+ <never_vertical>False</never_vertical>
+ <never_horizontal>False</never_horizontal>
+ <shadow_type>GTK_SHADOW_OUT</shadow_type>
+
+ <widget>
+ <class>GtkToolbar</class>
+ <name>toolbar1</name>
+ <border_width>1</border_width>
+ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
+ <type>GTK_TOOLBAR_BOTH</type>
+ <space_size>16</space_size>
+ <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
+ <relief>GTK_RELIEF_NONE</relief>
+ <tooltips>True</tooltips>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>new_store_button</name>
+ <label>new store</label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_NEW</stock_pixmap>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHPaned</class>
+ <child_name>GnomeDock:contents</child_name>
+ <name>hpaned1</name>
+ <handle_size>10</handle_size>
+ <gutter_size>6</gutter_size>
+ <position>0</position>
+
+ <widget>
+ <class>GtkCTree</class>
+ <name>ctree1</name>
+ <can_focus>True</can_focus>
+ <columns>1</columns>
+ <column_widths>80</column_widths>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ <show_titles>True</show_titles>
+ <shadow_type>GTK_SHADOW_IN</shadow_type>
+ <child>
+ <shrink>True</shrink>
+ <resize>False</resize>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CTree:title</child_name>
+ <name>store_and_inbox_name</name>
+ <label>name</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkCList</class>
+ <name>clist1</name>
+ <can_focus>True</can_focus>
+ <columns>3</columns>
+ <column_widths>80,80,80</column_widths>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ <show_titles>True</show_titles>
+ <shadow_type>GTK_SHADOW_IN</shadow_type>
+ <child>
+ <shrink>True</shrink>
+ <resize>True</resize>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>message_date_label</name>
+ <label>Date</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>message_sender_label</name>
+ <label>Sender</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>message_subject_label</name>
+ <label>Subject</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeAppBar</class>
+ <child_name>GnomeApp:appbar</child_name>
+ <name>appbar1</name>
+ <has_progress>True</has_progress>
+ <has_status>True</has_status>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+</widget>
+
+<widget>
+ <class>GnomeAbout</class>
+ <name>about_widget</name>
+ <visible>False</visible>
+ <modal>True</modal>
+ <copyright></copyright>
+ <authors>Bertrand Guiheneuf &lt;Bertrand.Guiheneuf@aful.org&gt;
+</authors>
+ <comments>This is a very simple program to test Camel</comments>
+</widget>
+
+</GTK-Interface>