+2001-12-21
+
+ * src/template.c: template_write_config(): fixed a typo.
+ * src/compose.c: toolbar_linewrap_cb(): call compose_wrap_line_all().
+ * src/filter.[ch]
+ src/prefs_filter.c: supported regular expression (thanks to
+ Yukihiro Nakai).
+ * src/undo.c: undo_paste_clipboard_cb(): fixed a bug that broke
+ undo state when pasted clipboard was empty.
+ undo_check_size(): use g_list_last().
+ undo_undo()
+ undo_redo(): fixed NULL checking and made a bit of optimization.
+ Some code cleanups.
+ * src/prefs_common.c: changed the default value of linewrap length
+ to 72.
+
+2001-12-20
+
+ * reorganization of pixmap management.
+ * src/stock_pixmap.[ch]: new. This module manages all static pixmaps.
+ * modified every files which directly use pixmaps data to use
+ stock_pixmap_*().
+ * src/undo.[ch]: renamed undo_set_undo_change_funct() to
+ undo_set_change_state_func(), and changed its argument from
+ GtkWidget* to gpointer.
+ undo_merge(): code cleanup.
+ * src/compose.c: renamed compose_set_undo() to
+ compose_undo_state_changed().
+
+2001-12-19
+
+ * src/account.c: account_find_from_address(): made it case
+ insensitive.
+ * src/addressbook.c: addressbook_create(): set wmclass.
+ * src/compose.c: compose_insert_file(): supported DOS/Win/Mac line
+ break.
+ * src/importldif.c
+ src/ldif.[ch]: merged from the claws branch.
+ * src/importldif.c: removed some warnings.
+ imp_ldif_field_list_toggle(): fixed button checking.
+ imp_ldif_dialog_create(): minor layout fix.
+ * src/ldif.c: removed some warnings.
+ * INSTALL
+ INSTALL.jp: updated confirmation list.
+ * src/vcard.c:
+ vcard_read_file()
+ vcard_test_read_file(): fixed a memory leak of tagtemp.
+ Some code cleanups (decreasing the indent level).
+ * src/addrindex.c
+ src/jpilot.[ch]
+ src/syldap.[ch]: disabled runtime library checking because JPilot
+ and LDAP libraries are linked on the build time, and the program
+ doesn't execute without them anyway.
+ * src/addressbook.c
+ src/addrindex.c: changed "J-Pilot" to "JPilot".
+ Removed warning for atoi().
+
2001-12-18
* src/procmsg.c: procmsg_empty_trash()
+2001-12-21 [alfons] 0.6.6claws7
+
+ * sync with sylpheed 0.6.6cvs4-9
+ (may have forgotten something: LAST_STABLE is 0.6.6claws6)
+
2001-12-21 [christoph] 0.6.6claws6
* src/compose.c
+2001-12-21
+
+ * src/template.c: template_write_config(): typo ¤ò½¤Àµ¡£
+ * src/compose.c: toolbar_linewrap_cb(): compose_wrap_line_all() ¤ò
+ ¸Æ¤Ö¤è¤¦¤Ë¤·¤¿¡£
+ * src/filter.[ch]
+ src/prefs_filter.c: Àµµ¬É½¸½¤ËÂбþ(Ãæ°æ¤µ¤ó thanks)¡£
+ * src/undo.c: undo_paste_clipboard_cb(): ¥Ú¡¼¥¹¥È¤·¤¿¥¯¥ê¥Ã¥×¥Ü¡¼¥É
+ ¤¬¶õ¤Î¤È¤¥¢¥ó¥É¥¥¤Î¾õÂÖ¤òÇ˲õ¤¹¤ë¥Ð¥°¤ò½¤Àµ¡£
+ undo_check_size(): g_list_last() ¤ò»ÈÍÑ¡£
+ undo_undo()
+ undo_redo(): NULL ¥Á¥§¥Ã¥¯¤ò½¤Àµ¤·¡¢¾¯¤·ºÇŬ²½¡£
+ ¥³¡¼¥É¤ÎÀ°Íý¡£
+ * src/prefs_common.c: ¼«Æ°²þ¹Ô¤Î¹ÔĹ¤Î¥Ç¥Õ¥©¥ë¥È¤ò72¤ËÊѹ¹¡£
+
+2001-12-20
+
+ * pixmap ´ÉÍý¤ÎºÆ¹½À®¡£
+ * src/stock_pixmap.[ch]: ¿·µ¬¡£¤³¤Î¥â¥¸¥å¡¼¥ë¤ÏÁ´¤Æ¤Î static ¤Ê
+ pixmap ¤ò´ÉÍý¤¹¤ë¡£
+ * pixmap ¥Ç¡¼¥¿¤òľÀܻȤ¦Á´¤Æ¤Î¥Õ¥¡¥¤¥ë¤ò stock_pixmap_*() ¤ò
+ »ÈÍѤ¹¤ë¤è¤¦¤Ë½¤Àµ¡£
+ * src/undo.[ch]: undo_set_undo_change_funct() ¤ò
+ undo_set_change_state_func() ¤Ë̾¾ÎÊѹ¹¤·¡¢°ú¿ô¤ò GtkWidget*
+ ¤«¤é gpointer ¤ËÊѹ¹¡£
+ undo_merge(): ¥³¡¼¥É¤ÎÀ°Íý¡£
+ * src/compose.c: compose_set_undo() ¤ò compose_undo_state_changed()
+ ¤Ë̾¾ÎÊѹ¹¡£
+
+2001-12-19
+
+ * src/account.c: account_find_from_address(): Â羮ʸ»ú¤ò¶èÊ̤·¤Ê¤¤
+ ¤è¤¦¤Ë¤·¤¿¡£
+ * src/addressbook.c: addressbook_create(): wmclass ¤ò¥»¥Ã¥È¡£
+ * src/compose.c: compose_insert_file(): DOS/Win/Mac ¤Î²þ¹Ô¤ËÂбþ¡£
+ * src/importldif.c
+ src/ldif.[ch]: claws ¥Ö¥é¥ó¥Á¤«¤é¥Þ¡¼¥¸¡£
+ * src/importldif.c: ·Ù¹ð¤ò½üµî¡£
+ imp_ldif_field_list_toggle(): ¥Ü¥¿¥ó¤Î¥Á¥§¥Ã¥¯¤ò½¤Àµ¡£
+ imp_ldif_dialog_create(): ¥ì¥¤¥¢¥¦¥È¤ò¤ï¤º¤«¤Ë½¤Àµ¡£
+ * src/ldif.c: ·Ù¹ð¤ò½üµî¡£
+ * INSTALL
+ INSTALL.jp: Æ°ºî³Îǧ¥ê¥¹¥È¤ò¹¹¿·¡£
+ * src/vcard.c:
+ vcard_read_file()
+ vcard_test_read_file(): tagtemp ¤Î¥á¥â¥ê¥ê¡¼¥¯¤ò½¤Àµ¡£
+ ¥³¡¼¥É¤ÎÀ°Íý(¥¤¥ó¥Ç¥ó¥È¤Î¥ì¥Ù¥ë¤òºï¸º)¡£
+ * src/addrindex.c
+ src/jpilot.[ch]
+ src/syldap.[ch]: JPilot ¤È LDAP ¤Î¥é¥¤¥Ö¥é¥ê¤Ï¥Ó¥ë¥É»þ¤Ë¥ê¥ó¥¯¤µ¤ì¡¢
+ ¤½¤ì¤é¤Ê¤·¤Ç¤Ï·ë¶É¼Â¹Ô¤Ç¤¤Ê¤¤¤¿¤á¡¢¼Â¹Ô»þ¤Î¥é¥¤¥Ö¥é¥ê¥Á¥§¥Ã¥¯¤ò
+ ¹Ô¤ï¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+ * src/addressbook.c
+ src/addrindex.c: "J-Pilot" ¤ò "JPilot" ¤ËÊѹ¹¡£
+ atoi() ¤Î·Ù¹ð¤ò½üµî¡£
+
2001-12-18
* src/procmsg.c: procmsg_empty_trash()
It is confirmed to work on the following environments:
+Linux
+
o Debian GNU/Linux unstable (sid) (glibc 2.2.x)
o Debian GNU/Linux testing (woody) (glibc 2.2.x)
o Debian GNU/Linux 2.2 (potato) (glibc 2.1.3)
o Kondara MNU/Linux (glibc 2.1.x)
+o Kondara MNU/Linux 1.2
+o Kondara MNU/Linux 2.0
o Vine Linux 1.1 (glibc 2.0.x + libwcsmbs)
o Vine Linux 2.0 (glibc 2.1.x) (Intel, PPC)
o Vine Linux 2.1
+o Vine Linux 2.1.5
o Laser5 Linux 6.0 (glibc 2.1.x)
o Laser5 Linux 6.2 (glibc 2.1.x)
o Laser5 Linux 6.4 (glibc 2.1.x)
o TurboLinux 4.0 (glibc 2.0.7 + libwcsmbs)
o TurboLinux 6.0 (glibc 2.1.2)
+o TurboLinux 7.0 (glibc 2.2.x)
o Miracle Linux Standard Edition Version1.0
o Miracle Linux for PostgreSQL Version1.0
o Miracle Linux for Samba Version1.0
o Vector Linux 1.5
o Yellow Dog Linux 2.0 (glibc 2.2.1)
o Yellow Dog Linux 2.1 (PowerPC)
+
+BSD
+
o FreeBSD 3.2-RELEASE
o FreeBSD 3.4-RELEASE
o FreeBSD 4.0-RELEASE
o OpenBSD 2.7
o OpenBSD 2.8 (i386)
o OpenBSD 2.9
+o OpenBSD 3.0
o BSD/OS 4.0.1
+
+Other commercial Unix
+
o Solaris 2.5
o Solaris 2.5.1
o Solaris 2.6
o Tru64 Unix 5.0 (OSF1 V5.0)
o SCO UnixWare 7
o Mac OS X (Darwin 1.3) + Xtools (has locale problem)
+
+Others
+
o Windows (cygwin + GTK+ for win32) (unstable)
°Ê²¼¤Î´Ä¶¤ÇÆ°ºî¤¬³Îǧ¤µ¤ì¤Æ¤¤¤Þ¤¹:
+Linux
+
o Debian GNU/Linux unstable (sid) (glibc 2.2.x)
o Debian GNU/Linux testing (woody) (glibc 2.2.x)
o Debian GNU/Linux 2.2 (potato) (glibc 2.1.3)
o Kondara MNU/Linux (glibc 2.1.x)
+o Kondara MNU/Linux 1.2
+o Kondara MNU/Linux 2.0
o Vine Linux 1.1 (glibc 2.0.x + libwcsmbs)
o Vine Linux 2.0 (glibc 2.1.x) (Intel, PPC)
o Vine Linux 2.1
+o Vine Linux 2.1.5
o Laser5 Linux 6.0 (glibc 2.1.x)
o Laser5 Linux 6.2 (glibc 2.1.x)
o Laser5 Linux 6.4 (glibc 2.1.x)
o TurboLinux 4.0 (glibc 2.0.7 + libwcsmbs)
o TurboLinux 6.0 (glibc 2.1.2)
+o TurboLinux 7.0 (glibc 2.2.x)
o Miracle Linux Standard Edition Version1.0
o Miracle Linux for PostgreSQL Version1.0
o Miracle Linux for Samba Version1.0
o Vector Linux 1.5
o Yellow Dog Linux 2.0 (glibc 2.2.1)
o Yellow Dog Linux 2.1 (PowerPC)
+
+BSD
+
o FreeBSD 3.2-RELEASE
o FreeBSD 3.4-RELEASE
o FreeBSD 4.0-RELEASE
o OpenBSD 2.7
o OpenBSD 2.8 (i386)
o OpenBSD 2.9
+o OpenBSD 3.0
o BSD/OS 4.0.1
+
+¤½¤Î¾¾¦ÍÑ Unix
+
o Solaris 2.5
o Solaris 2.5.1
o Solaris 2.6
o Tru64 Unix 5.0 (OSF1 V5.0)
o SCO UnixWare 7
o Mac OS X (Darwin 1.3) + Xtools (locale ¤ËÌäÂꤢ¤ê)
+
+¤½¤Î¾
+
o Windows (cygwin + GTK+ for win32) (unstable)
* The newsgroup subscription dialog has been enhanced.
* Template function has been improved.
* New wrapping function for composition window has been implemented.
- * Mailto URL has been supported on the --compose option.
- * The --status option that displays current message count was added.
+ * Mailto URL has been supported for the --compose option.
+ * The --status option to display current message count has been added.
* Workaround for RFC-incompliant Date header has been made.
* Check connection between IMAP or NNTP server only if access time
limit is expired.
* Thai encodings have been supported.
* Hungarian message catalog has been added.
* Copy and paste problems have been fixed.
+ * Some IMAP4 bugs have been fixed.
* Some other bugs have been fixed.
* 0.6.5
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws6
+EXTRA_VERSION=claws7
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl
gtkshruler.c gtkshruler.h \
gtksctree.c gtksctree.h \
menu.c menu.h \
+ stock_pixmap.c stock_pixmap.h \
prefs.c prefs.h \
prefs_common.c prefs_common.h \
prefs_filter.c prefs_filter.h \
#include <gtk/gtksignal.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkhbox.h>
-#include <gtk/gtkpixmap.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkhseparator.h>
#include <gtk/gtkscrolledwindow.h>
#include "intl.h"
#include "about.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "prefs_common.h"
#include "utils.h"
#include "version.h"
-#include "pixmaps/sylpheed-logo.xpm"
-
static GtkWidget *window;
static void about_create(void);
static void about_create(void)
{
GtkWidget *vbox;
- GdkPixmap *logoxpm = NULL;
- GdkBitmap *logoxpmmask;
GtkWidget *pixmap;
GtkWidget *label;
GtkWidget *hbox;
vbox = gtk_vbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(window), vbox);
- PIXMAP_CREATE(window, logoxpm, logoxpmmask, sylpheed_logo_xpm);
- pixmap = gtk_pixmap_new(logoxpm, logoxpmmask);
+ pixmap = stock_pixmap_widget(window, STOCK_PIXMAP_SYLPHEED_LOGO);
gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 0);
label = gtk_label_new("version "VERSION);
#include "prefs_folder_item.h"
#include "compose.h"
#include "manage_window.h"
+#include "stock_pixmap.h"
#include "inc.h"
#include "gtkutils.h"
#include "utils.h"
GList *cur;
PrefsAccount *ac;
+ g_return_val_if_fail(address != NULL, NULL);
+ g_return_val_if_fail(smtp_server != NULL, NULL);
+
for (cur = account_list; cur != NULL; cur = cur->next) {
ac = (PrefsAccount *)cur->data;
if (!strcmp2(address, ac->address) &&
GList *cur;
PrefsAccount *ac;
+ g_return_val_if_fail(address != NULL, NULL);
+
for (cur = account_list; cur != NULL; cur = cur->next) {
ac = (PrefsAccount *)cur->data;
- if (ac->protocol != A_NNTP && strcasestr(address, ac->address))
+ if (ac->protocol != A_NNTP && ac->address &&
+ !g_strcasecmp(address, ac->address))
return ac;
}
GTK_SIGNAL_FUNC (account_edit_close),
NULL);
- PIXMAP_CREATE(clist, markxpm, markxpmmask, mark_xpm);
- PIXMAP_CREATE(clist, checkboxonxpm, checkboxonxpmmask, checkbox_on_xpm);
- PIXMAP_CREATE(clist, checkboxoffxpm, checkboxoffxpmmask,
- checkbox_off_xpm);
+ stock_pixmap_gdk(clist, STOCK_PIXMAP_MARK, &markxpm, &markxpmmask);
+ stock_pixmap_gdk(clist, STOCK_PIXMAP_CHECKBOX_ON,
+ &checkboxonxpm, &checkboxonxpmmask);
+ stock_pixmap_gdk(clist, STOCK_PIXMAP_CHECKBOX_OFF,
+ &checkboxoffxpm, &checkboxoffxpmmask);
edit_account.window = window;
edit_account.clist = clist;
#include "intl.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "prefs_common.h"
#include "addressadd.h"
#include "addritem.h"
#include "addrindex.h"
#include "manage_window.h"
-#include "pixmaps/book.xpm"
-#include "pixmaps/dir-open.xpm"
-
typedef struct {
AddressBookFile *book;
ItemFolder *folder;
gtk_widget_show_all( window );
- PIXMAP_CREATE( window, bookXpm, bookXpmMask, book_xpm );
- PIXMAP_CREATE( window, folderXpm, folderXpmMask, dir_open_xpm );
+ stock_pixmap_gdk( window, STOCK_PIXMAP_BOOK, &bookXpm, &bookXpmMask );
+ stock_pixmap_gdk( window, STOCK_PIXMAP_DIR_OPEN,
+ &folderXpm, &folderXpmMask );
}
static void addressadd_load_folder( GtkCTreeNode *parentNode, ItemFolder *parentFolder,
#include "alertpanel.h"
#include "inputdialog.h"
#include "menu.h"
+#include "stock_pixmap.h"
#include "xml.h"
#include "prefs.h"
#include "procmime.h"
#define ADDRESSBOOK_LDAP_BUSYMSG "Busy"
#endif
-#include "pixmaps/dir-close.xpm"
-#include "pixmaps/dir-open.xpm"
-#include "pixmaps/group.xpm"
-#include "pixmaps/interface.xpm"
-#include "pixmaps/book.xpm"
-#include "pixmaps/address.xpm"
-#include "pixmaps/vcard.xpm"
-#include "pixmaps/jpilot.xpm"
-#include "pixmaps/category.xpm"
-#include "pixmaps/ldap.xpm"
-
typedef enum
{
COL_NAME = 0,
static void addressbook_list_select_add (AddressObject *obj);
static void addressbook_list_select_remove (AddressObject *obj);
-static void addressbook_import_ldif_cb ();
+static void addressbook_import_ldif_cb (void);
static void addressbook_import_mutt_cb ();
static GtkItemFactoryEntry addressbook_entries[] =
{N_("/_File/New _Book"), "<alt>B", addressbook_new_book_cb, 0, NULL},
{N_("/_File/New _vCard"), "<alt>D", addressbook_new_vcard_cb, 0, NULL},
#ifdef USE_JPILOT
- {N_("/_File/New _J-Pilot"), "<alt>J", addressbook_new_jpilot_cb, 0, NULL},
+ {N_("/_File/New _JPilot"), "<alt>J", addressbook_new_jpilot_cb, 0, NULL},
#endif
#ifdef USE_LDAP
{N_("/_File/New _Server"), "<alt>S", addressbook_new_ldap_cb, 0, NULL},
{N_("/_Address/_Edit"), "<alt>Return", addressbook_edit_address_cb, 0, NULL},
{N_("/_Address/_Delete"), NULL, addressbook_delete_address_cb, 0, NULL},
{N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
- {N_("/_Tools/Import _LDIF"), NULL, addressbook_import_ldif_cb, 0, NULL},
+ {N_("/_Tools/Import _LDIF file"), NULL, addressbook_import_ldif_cb, 0, NULL},
{N_("/_Tools/Import M_utt"), NULL, addressbook_import_mutt_cb, 0, NULL},
{N_("/_Help"), NULL, NULL, 0, "<LastBranch>"},
{N_("/_Help/_About"), NULL, about_show, 0, NULL}
{N_("/_Tools/Import _Mozilla"), NULL, NULL, 0, NULL},
{N_("/_Tools/Import _vCard"), NULL, NULL, 0, NULL},
{N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
- {N_("/_Tools/Export _LDIF"), NULL, NULL, 0, NULL},
- {N_("/_Tools/Export V-_Card"), NULL, NULL, 0, NULL},
+ {N_("/_Tools/Export _LDIF file"), NULL, NULL, 0, NULL},
+ {N_("/_Tools/Export v_Card"), NULL, NULL, 0, NULL},
*/
static GtkItemFactoryEntry addressbook_tree_popup_entries[] =
GINT_TO_POINTER(COMPOSE_BCC));
/* Build icons for interface */
- PIXMAP_CREATE( window, interfacexpm, interfacexpmmask, interface_xpm );
+ stock_pixmap_gdk( window, STOCK_PIXMAP_INTERFACE,
+ &interfacexpm, &interfacexpmmask );
/* Build control tables */
addrbookctl_build_map(window);
menu_set_sensitive( addrbook.menu_factory, "/File/New Book", sensitive );
menu_set_sensitive( addrbook.menu_factory, "/File/New vCard", sensitive );
#ifdef USE_JPILOT
- menu_set_sensitive( addrbook.menu_factory, "/File/New J-Pilot", sensitive );
+ menu_set_sensitive( addrbook.menu_factory, "/File/New JPilot", sensitive );
#endif
#ifdef USE_LDAP
menu_set_sensitive( addrbook.menu_factory, "/File/New Server", sensitive );
/* Edit person - basic page */
ItemPerson *person = ( ItemPerson * ) obj;
if( addressbook_edit_person( abf, NULL, person, FALSE ) == NULL ) return;
- gtk_ctree_select( ctree, addrbook.opened);
+ gtk_ctree_select( ctree, addrbook.opened );
invalidate_address_completion();
return;
}
AddressTypeControlItem *atci;
/* Build icons */
- PIXMAP_CREATE(window, folderxpm, folderxpmmask, dir_close_xpm);
- PIXMAP_CREATE(window, folderopenxpm, folderopenxpmmask, dir_open_xpm);
- PIXMAP_CREATE(window, groupxpm, groupxpmmask, group_xpm);
- PIXMAP_CREATE(window, vcardxpm, vcardxpmmask, vcard_xpm);
- PIXMAP_CREATE(window, bookxpm, bookxpmmask, book_xpm);
- PIXMAP_CREATE(window, addressxpm, addressxpmmask, address_xpm);
- PIXMAP_CREATE(window, jpilotxpm, jpilotxpmmask, jpilot_xpm);
- PIXMAP_CREATE(window, categoryxpm, categoryxpmmask, category_xpm);
- PIXMAP_CREATE(window, ldapxpm, ldapxpmmask, ldap_xpm);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_DIR_CLOSE, &folderxpm, &folderxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_DIR_OPEN, &folderopenxpm, &folderopenxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_GROUP, &groupxpm, &groupxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_VCARD, &vcardxpm, &vcardxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_BOOK, &bookxpm, &bookxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_ADDRESS, &addressxpm, &addressxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_JPILOT, &jpilotxpm, &jpilotxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_CATEGORY, &categoryxpm, &categoryxpmmask);
+ stock_pixmap_gdk(window, STOCK_PIXMAP_LDAP, &ldapxpm, &ldapxpmmask);
_addressBookTypeHash_ = g_hash_table_new( g_int_hash, g_int_equal );
_addressBookTypeList_ = NULL;
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
- /* J-Pilot */
+ /* JPilot */
atci = g_new0( AddressTypeControlItem, 1 );
atci->objectType = ADDR_JPILOT;
atci->interfaceType = ADDR_IF_JPILOT;
atci->showInTree = TRUE;
atci->treeExpand = TRUE;
atci->treeLeaf = FALSE;
- atci->displayName = _( "J-Pilot" );
+ atci->displayName = _( "JPilot" );
atci->iconXpm = jpilotxpm;
atci->maskXpm = jpilotxpmmask;
atci->iconXpmOpen = jpilotxpm;
atci->maskXpmOpen = jpilotxpmmask;
- atci->menuCommand = "/File/New J-Pilot";
+ atci->menuCommand = "/File/New JPilot";
g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
_addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
atci->showInTree = TRUE;
atci->treeExpand = TRUE;
atci->treeLeaf = TRUE;
- atci->displayName = _( "J-Pilot" );
+ atci->displayName = _( "JPilot" );
atci->iconXpm = categoryxpm;
atci->maskXpm = categoryxpmmask;
atci->iconXpmOpen = categoryxpm;
/*
* End of Source.
*/
-
#include "defs.h"
#include <glib.h>
+#include <stdlib.h>
#include "intl.h"
#include "mgutils.h"
addrIndex->interfaceList = g_list_append( addrIndex->interfaceList, iface );
ADDRITEM_PARENT(iface) = ADDRITEM_OBJECT(addrIndex);
- iface = addrindex_create_interface( ADDR_IF_JPILOT, "J-Pilot", TAG_IF_JPILOT, TAG_DS_JPILOT );
+ iface = addrindex_create_interface( ADDR_IF_JPILOT, "JPilot", TAG_IF_JPILOT, TAG_DS_JPILOT );
#ifdef USE_JPILOT
- iface->haveLibrary = jpilot_test_pilot_lib();
+ /* iface->haveLibrary = jpilot_test_pilot_lib(); */
+ iface->haveLibrary = TRUE;
iface->useInterface = iface->haveLibrary;
iface->getModifyFlag = ( void * ) jpilot_get_modified;
iface->getAccessFlag = ( void * ) jpilot_get_accessed;
iface = addrindex_create_interface( ADDR_IF_LDAP, "LDAP", TAG_IF_LDAP, TAG_DS_LDAP );
#ifdef USE_LDAP
- iface->haveLibrary = syldap_test_ldap_lib();
+ /* iface->haveLibrary = syldap_test_ldap_lib(); */
+ iface->haveLibrary = TRUE;
iface->useInterface = iface->haveLibrary;
iface->getAccessFlag = ( void * ) syldap_get_accessed;
/* iface->getModifyFlag = ( void * ) syldap_get_modified; */
#include "folderview.h"
#include "procmsg.h"
#include "menu.h"
+#include "stock_pixmap.h"
#include "send.h"
#include "imap.h"
#include "news.h"
static void compose_set_ext_editor_sensitive (Compose *compose,
gboolean sensitive);
-static void compose_set_undo (UndoMain *undostruct,
+static void compose_undo_state_changed (UndoMain *undostruct,
gint undo_state,
gint redo_state,
- GtkWidget *changewidget);
+ gpointer data);
static gint calc_cursor_xpos (GtkSText *text,
gint extra,
gtk_stext_freeze(text);
while (fgets(buf, sizeof(buf), fp) != NULL) {
- /* Strip <CR> if DOS/Windoze file, replace <CR> with <LF> if MAC file */
+ /* strip <CR> if DOS/Windows file,
+ replace <CR> with <LF> if Macintosh file. */
+ strcrchomp(buf);
len = strlen(buf);
- if (len > 1 && buf[len - 2] == '\r' && buf[len - 1] == '\n') {
- buf[len - 2] = '\n';
- buf[len - 1] = '\0';
- } else {
- while (--len > 0)
- if (buf[len] == '\r')
- buf[len] = '\n';
+ if (len > 0 && buf[len - 1] != '\n') {
+ while (--len >= 0)
+ if (buf[len] == '\r') buf[len] = '\n';
}
gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
}
undostruct = undo_init(text);
- undo_set_undo_change_funct(undostruct, &compose_set_undo, menubar);
+ undo_set_change_state_func(undostruct, &compose_undo_state_changed,
+ menubar);
gtk_widget_show(window);
static void compose_toolbar_create(Compose *compose, GtkWidget *container)
{
GtkWidget *toolbar;
- GdkPixmap *icon;
- GdkBitmap *mask;
GtkWidget *icon_wid;
GtkWidget *send_btn;
GtkWidget *sendl_btn;
gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_SPACE_LINE);
- CREATE_TOOLBAR_ICON(stock_mail_send_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_SEND);
send_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Send"),
_("Send message"),
"Send",
icon_wid, toolbar_send_cb, compose);
- CREATE_TOOLBAR_ICON(stock_mail_send_queue_xpm);
- /* CREATE_TOOLBAR_ICON(tb_mail_queue_send_xpm); */
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_SEND_QUEUE);
sendl_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Send later"),
_("Put into queue folder and send later"),
icon_wid, toolbar_send_later_cb,
compose);
- CREATE_TOOLBAR_ICON(stock_mail_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL);
draft_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Draft"),
_("Save to draft folder"),
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_paste_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_PASTE);
insert_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Insert"),
_("Insert file"),
icon_wid, toolbar_insert_cb,
compose);
- CREATE_TOOLBAR_ICON(stock_mail_attach_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_ATTACH);
attach_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Attach"),
_("Attach file"),
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_mail_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL);
sig_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Signature"),
_("Insert signature"),
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_mail_compose_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_COMPOSE);
exteditor_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Editor"),
_("Edit with external editor"),
toolbar_ext_editor_cb,
compose);
- CREATE_TOOLBAR_ICON(linewrap_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_LINEWRAP);
linewrap_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Linewrap"),
- _("Wrap current paragraph"),
+ _("Wrap all long lines"),
"Linewrap",
icon_wid,
toolbar_linewrap_cb,
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(tb_address_book_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_ADDRESS_BOOK);
addrbook_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Address"),
_("Address book"),
gtk_widget_show_all(toolbar);
}
-#undef CREATE_TOOLBAR_ICON
-
static GtkWidget *compose_account_option_menu_create(Compose *compose)
{
GList *accounts;
}
/**
- * undo_set_undo:
+ * compose_undo_state_changed:
*
* Change the sensivity of the menuentries undo and redo
**/
-static void compose_set_undo(UndoMain *undostruct, gint undo_state,
- gint redo_state, GtkWidget *changewidget)
+static void compose_undo_state_changed(UndoMain *undostruct, gint undo_state,
+ gint redo_state, gpointer data)
{
+ GtkWidget *widget = GTK_WIDGET(data);
GtkItemFactory *ifactory;
- g_return_if_fail(changewidget != NULL);
+ g_return_if_fail(widget != NULL);
debug_print("Set_undo. UNDO:%i REDO:%i\n", undo_state, redo_state);
- ifactory = gtk_item_factory_from_widget(changewidget);
+ ifactory = gtk_item_factory_from_widget(widget);
switch (undo_state) {
case UNDO_STATE_TRUE:
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <string.h>
#include <strings.h>
#include <stdlib.h>
+#include <regex.h>
#include "intl.h"
#include "procheader.h"
return strcasestr(haystack, needle) != NULL ? FALSE : TRUE;
}
+static gboolean strmatch_regex(const gchar *haystack, const gchar *needle)
+{
+ gint ret = 0;
+ regex_t preg;
+ regmatch_t pmatch[1];
+
+ ret = regcomp(&preg, needle, 0);
+ if (ret != 0) return FALSE;
+
+ ret = regexec(&preg, haystack, 1, pmatch, 0);
+ regfree(&preg);
+
+ if (ret == REG_NOMATCH) return FALSE;
+
+ if (pmatch[0].rm_so != -1)
+ return TRUE;
+ else
+ return FALSE;
+}
+
gboolean filter_match_condition(Filter *filter, GSList *hlist)
{
Header *header;
g_return_val_if_fail(filter->name1 != NULL, FALSE);
- if (FLT_IS_CASE_SENS(filter->flag1))
+ if (FLT_IS_REGEX(filter->flag1))
+ StrFind1 = strmatch_regex;
+ else if (FLT_IS_CASE_SENS(filter->flag1))
StrFind1 = FLT_IS_CONTAIN(filter->flag1)
? strfind : strnotfind;
else
StrFind1 = FLT_IS_CONTAIN(filter->flag1)
? strcasefind : strcasenotfind;
+ if (FLT_IS_REGEX(filter->flag2))
+ StrFind2 = strmatch_regex;
if (FLT_IS_CASE_SENS(filter->flag2))
StrFind2 = FLT_IS_CONTAIN(filter->flag2)
? strfind : strnotfind;
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
typedef enum
{
FLT_CONTAIN = 1 << 0,
- FLT_CASE_SENS = 1 << 1
+ FLT_CASE_SENS = 1 << 1,
+ FLT_REGEX = 1 << 2
} FilterFlag;
typedef enum
#define FLT_IS_CONTAIN(flag) ((flag & FLT_CONTAIN) != 0)
#define FLT_IS_CASE_SENS(flag) ((flag & FLT_CASE_SENS) != 0)
+#define FLT_IS_REGEX(flag) ((flag & FLT_REGEX) != 0)
struct _Filter
{
#include "main.h"
#include "utils.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "foldersel.h"
#include "alertpanel.h"
#include "manage_window.h"
#include "folder.h"
-#include "pixmaps/dir-close.xpm"
-#include "pixmaps/dir-open.xpm"
-
static GdkPixmap *folderxpm;
static GdkBitmap *folderxpmmask;
static GdkPixmap *folderopenxpm;
static void foldersel_init(void)
{
- PIXMAP_CREATE(ctree, folderxpm, folderxpmmask, dir_close_xpm);
- PIXMAP_CREATE(ctree, folderopenxpm, folderopenxpmmask, dir_open_xpm);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE,
+ &folderxpm, &folderxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN,
+ &folderopenxpm, &folderopenxpmmask);
}
static gboolean foldersel_gnode_func(GtkCTree *ctree, guint depth,
#include "manage_window.h"
#include "alertpanel.h"
#include "menu.h"
+#include "stock_pixmap.h"
#include "procmsg.h"
#include "utils.h"
#include "gtkutils.h"
#include "folder.h"
#include "inc.h"
-#include "pixmaps/inbox.xpm"
-#include "pixmaps/inbox-hrm.xpm"
-#include "pixmaps/outbox.xpm"
-#include "pixmaps/outbox-hrm.xpm"
-#include "pixmaps/dir-close.xpm"
-#include "pixmaps/dir-open.xpm"
-#include "pixmaps/dir-open-hrm.xpm"
-#include "pixmaps/trash.xpm"
-#include "pixmaps/trash-hrm.xpm"
-
typedef enum
{
COL_FOLDER = 0,
{
GtkWidget *ctree = folderview->ctree;
- PIXMAP_CREATE(ctree, inboxxpm, inboxxpmmask, inbox_xpm);
- PIXMAP_CREATE(ctree, inboxhrmxpm, inboxhrmxpmmask, inbox_hrm_xpm);
- PIXMAP_CREATE(ctree, outboxxpm, outboxxpmmask, outbox_xpm);
- PIXMAP_CREATE(ctree, outboxhrmxpm, outboxhrmxpmmask, outbox_hrm_xpm);
- PIXMAP_CREATE(ctree, folderxpm, folderxpmmask, dir_close_xpm);
- PIXMAP_CREATE(ctree, folderopenxpm, folderopenxpmmask, dir_open_xpm);
- PIXMAP_CREATE(ctree, folderopenhrmxpm, folderopenhrmxpmmask,
- dir_open_hrm_xpm);
- PIXMAP_CREATE(ctree, trashxpm, trashxpmmask, trash_xpm);
- PIXMAP_CREATE(ctree, trashhrmxpm, trashhrmxpmmask, trash_hrm_xpm);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX, &inboxxpm, &inboxxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_OUTBOX,
+ &outboxxpm, &outboxxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_CLOSE,
+ &folderxpm, &folderxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_OPEN,
+ &folderopenxpm, &folderopenxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH, &trashxpm, &trashxpmmask);
if (!normalfont)
normalfont = gdk_fontset_load(NORMAL_FONT);
#include "addressbook.h"
#include "addressitem.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "prefs_common.h"
#include "manage_window.h"
#include "mgutils.h"
#include "ldif.h"
-#include "pixmaps/mark.xpm"
-
#define IMPORTLDIF_GUESS_NAME "LDIF Import"
#define PAGE_FILE_INFO 0
static void imp_ldif_field_list_toggle( GtkCList *clist, GdkEventButton *event, gpointer data ) {
if( ! event ) return;
if( impldif_dlg.rowIndSelect < 0 ) return;
- if( event->button = 1 ) {
+ if( event->button == 1 ) {
if( event->type == GDK_2BUTTON_PRESS ) {
Ldif_FieldRec *rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect );
if( rec ) {
ldif_set_file( _ldifFile_, sFile );
if( ldif_read_tags( _ldifFile_ ) == MGU_SUCCESS ) {
/* Load fields */
- // ldif_print_file( _ldifFile_, stdout );
+ /* ldif_print_file( _ldifFile_, stdout ); */
imp_ldif_load_fields( _ldifFile_ );
retVal = TRUE;
}
GtkWidget *label;
GtkWidget *file_entry;
GtkWidget *name_entry;
- GtkWidget *hbbox;
- GtkWidget *hsep;
GtkWidget *file_btn;
- GtkWidget *hsbox;
gint top;
vbox = gtk_vbox_new(FALSE, 8);
gtk_table_set_row_spacings(GTK_TABLE(table), 8);
gtk_table_set_col_spacings(GTK_TABLE(table), 8 );
- // First row
+ /* First row */
top = 0;
label = gtk_label_new(_("Address Book"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
gtk_table_attach(GTK_TABLE(table), name_entry, 1, 2, top, (top + 1),
GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
- // Second row
+ /* Second row */
top = 1;
label = gtk_label_new(_("File Name"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
GtkWidget *labelBook;
GtkWidget *labelFile;
GtkWidget *labelRecs;
- GtkWidget *hbbox;
- GtkWidget *hsep;
- GtkWidget *file_btn;
- GtkWidget *hsbox;
gint top;
vbox = gtk_vbox_new(FALSE, 8);
GtkWidget *vnbox;
GtkWidget *notebook;
GtkWidget *hbbox;
- GtkWidget *hsep;
GtkWidget *btnPrev;
GtkWidget *btnNext;
GtkWidget *btnCancel;
gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
/* Button panel */
- gtkut_button_set_create( &hbbox, &btnPrev, _( "Prev" ),
- &btnNext, _( "Next" ), &btnCancel, _( "Dismiss" ) );
+ gtkut_button_set_create(&hbbox, &btnPrev, _( "Prev" ),
+ &btnNext, _( "Next" ),
+ &btnCancel, _( "Cancel" ) );
gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2);
gtk_widget_grab_default(btnNext);
/* Button handlers */
gtk_notebook_set_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FILE_INFO );
gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE );
gtk_widget_set_sensitive( impldif_dlg.btnNext, TRUE );
- PIXMAP_CREATE( impldif_dlg.window, markxpm, markxpmmask, mark_xpm);
+ stock_pixmap_gdk( impldif_dlg.window, STOCK_PIXMAP_MARK,
+ &markxpm, &markxpmmask );
imp_ldif_message();
gtk_widget_grab_focus(impldif_dlg.file_entry);
#include "gtkutils.h"
#include "statusbar.h"
#include "manage_window.h"
+#include "stock_pixmap.h"
#include "progressdialog.h"
#include "inputdialog.h"
#include "alertpanel.h"
#include "folder.h"
#include "filtering.h"
-#include "pixmaps/continue.xpm"
-#include "pixmaps/complete.xpm"
-#include "pixmaps/error.xpm"
-
static guint inc_lock_count = 0;
static GdkPixmap *currentxpm;
progress_dialog_set_value(progress, 0.0);
- PIXMAP_CREATE(progress->clist, okxpm, okxpmmask, complete_xpm);
- PIXMAP_CREATE(progress->clist,
- currentxpm, currentxpmmask, continue_xpm);
- PIXMAP_CREATE(progress->clist, errorxpm, errorxpmmask, error_xpm);
+ stock_pixmap_gdk(progress->clist, STOCK_PIXMAP_COMPLETE,
+ &okxpm, &okxpmmask);
+ stock_pixmap_gdk(progress->clist, STOCK_PIXMAP_CONTINUE,
+ ¤txpm, ¤txpmmask);
+ stock_pixmap_gdk(progress->clist, STOCK_PIXMAP_ERROR,
+ &errorxpm, &errorxpmmask);
if (prefs_common.recv_dialog_mode == RECV_DIALOG_ALWAYS ||
(prefs_common.recv_dialog_mode == RECV_DIALOG_ACTIVE &&
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
-#include <dlfcn.h>
+/* #include <dlfcn.h> */
#include <netinet/in.h>
#ifdef HAVE_LIBPISOCK_PI_ARGS_H
* Test whether pilot link library installed.
* Return: TRUE if library available.
*/
+#if 0
gboolean jpilot_test_pilot_lib( void ) {
void *handle, *fun;
dlclose( handle );
return TRUE;
}
+#endif /* 0 */
#endif /* USE_JPILOT */
void jpilot_add_custom_label ( JPilotFile *pilotFile, const gchar *labelName );
GList *jpilot_get_custom_labels ( JPilotFile *pilotFile );
gboolean jpilot_test_custom_label ( JPilotFile *pilotFile, const gchar *labelName );
-gboolean jpilot_test_pilot_lib ( void );
+/* gboolean jpilot_test_pilot_lib ( void ); */
gint jpilot_read_modified ( JPilotFile *pilotFile );
Ldif_FieldRec *fld = NULL;
Ldif_UserAttr *attr = NULL;
gchar *name;
- gchar *value;
fld = g_hash_table_lookup( hashField, tagName );
if( fld ) {
/*
* Print parsed data.
*/
+#if 0
static void ldif_print_record( Ldif_ParsedRec *rec, FILE *stream ) {
GSList *list;
}
list = NULL;
}
+#endif
static void ldif_dump_b64( gchar *buf ) {
Base64Decoder *decoder = NULL;
static int ldif_field_compare( gconstpointer ptr1, gconstpointer ptr2 ) {
const Ldif_FieldRec *rec1 = ptr1;
const Ldif_FieldRec *rec2 = ptr2;
- return strcasecmp(rec1->tagName, rec2->tagName );
+ return g_strcasecmp( rec1->tagName, rec2->tagName );
}
/*
#include "message_search.h"
#include "headerview.h"
#include "menu.h"
+#include "stock_pixmap.h"
#include "folder.h"
#include "inc.h"
#include "compose.h"
debug_print(_("done.\n"));
}
-#include "pixmaps/stock_mail_receive.xpm"
-#include "pixmaps/stock_mail_receive_all.xpm"
-#include "pixmaps/stock_mail_compose.xpm"
-#include "pixmaps/stock_news_compose.xpm"
-#include "pixmaps/stock_mail_reply.xpm"
-#include "pixmaps/stock_mail_reply_to_all.xpm"
-#include "pixmaps/stock_mail_reply_to_author.xpm"
-#include "pixmaps/stock_mail_forward.xpm"
-#include "pixmaps/stock_mail_send.xpm"
-#include "pixmaps/stock_preferences.xpm"
-#include "pixmaps/stock_properties.xpm"
-#include "pixmaps/stock_down_arrow.xpm"
-#include "pixmaps/stock_close.xpm"
-#include "pixmaps/stock_exec.xpm"
-
-#define CREATE_TOOLBAR_ICON(xpm_d) \
-{ \
- icon = gdk_pixmap_create_from_xpm_d(container->window, &mask, \
- &container->style->white, \
- xpm_d); \
- icon_wid = gtk_pixmap_new(icon, mask); \
-}
-
static void main_window_toolbar_create(MainWindow *mainwin,
GtkWidget *container)
{
GtkWidget *toolbar;
- GdkPixmap *icon;
- GdkBitmap *mask;
GtkWidget *icon_wid;
GtkWidget *get_btn;
GtkWidget *getall_btn;
gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_SPACE_LINE);
- CREATE_TOOLBAR_ICON(stock_mail_receive_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_RECEIVE);
get_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Get"),
_("Get new mail from current account"),
"Get",
icon_wid, toolbar_inc_cb, mainwin);
- CREATE_TOOLBAR_ICON(stock_mail_receive_all_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_RECEIVE_ALL);
getall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Get all"),
_("Get new mail from all accounts"),
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_mail_send_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_SEND);
send_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Send"),
_("Send queued message(s)"),
mainwin);
/* insert compose mail button widget */
-
- CREATE_TOOLBAR_ICON(stock_mail_compose_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_COMPOSE);
compose_mail_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Email"),
_("Compose an email message"),
mainwin);
/* insert compose news button widget */
-
- CREATE_TOOLBAR_ICON(stock_news_compose_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_NEWS_COMPOSE);
compose_news_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("News"),
_("Compose a news message"),
/* reply button */
- CREATE_TOOLBAR_ICON(stock_mail_reply_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY);
reply_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Reply"),
_("Reply to the message - Right button: more options"),
mainwin);
/* replyall button */
-
- CREATE_TOOLBAR_ICON(stock_mail_reply_to_all_xpm);
+
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY_TO_ALL);
replyall_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("All"),
_("Reply to all - Right button: more options"),
mainwin);
/* reply to sender button */
-
- CREATE_TOOLBAR_ICON(stock_mail_reply_to_author_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR);
replysender_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Sender"),
_("Reply to sender - Right button: more options"),
mainwin);
/* forward button */
-
- CREATE_TOOLBAR_ICON(stock_mail_forward_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_MAIL_FORWARD);
fwd_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Forward"),
_("Forward the message - Right button: more options"),
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_close_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_CLOSE);
delete_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Delete"),
_("Delete the message"),
toolbar_delete_cb,
mainwin);
- CREATE_TOOLBAR_ICON(stock_exec_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_EXEC);
exec_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Execute"),
_("Execute marked process"),
toolbar_exec_cb,
mainwin);
- CREATE_TOOLBAR_ICON(stock_down_arrow_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_DOWN_ARROW);
next_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Next"),
_("Next unread message"),
/*
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
- CREATE_TOOLBAR_ICON(stock_preferences_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_PREFERENCES);
prefs_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Prefs"),
_("Common preference"),
icon_wid,
toolbar_prefs_cb,
mainwin);
- CREATE_TOOLBAR_ICON(stock_properties_xpm);
+ icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_PROPERTIES);
account_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
_("Account"),
_("Account setting"),
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gint manage_window_focus_in(GtkWidget *widget, GdkEventFocus *event,
gpointer data)
{
- debug_print("Focus in event: window: %08x\n", (guint)widget);
+ /* debug_print("Focus in event: window: %08x\n", (guint)widget); */
focus_window = widget;
gint manage_window_focus_out(GtkWidget *widget, GdkEventFocus *event,
gpointer data)
{
- debug_print("Focused window: %08x\n", (guint)focus_window);
- debug_print("Focus out event: window: %08x\n", (guint)widget);
+ /* debug_print("Focused window: %08x\n", (guint)focus_window); */
+ /* debug_print("Focus out event: window: %08x\n", (guint)widget); */
if (focus_window == widget)
focus_window = NULL;
void manage_window_set_transient(GtkWindow *window)
{
- debug_print("window = %08x, focus_window = %08x\n",
- (guint)window, (guint)focus_window);
+ /* debug_print("window = %08x, focus_window = %08x\n",
+ (guint)window, (guint)focus_window); */
if (window && focus_window)
gtk_window_set_transient_for(window, GTK_WINDOW(focus_window));
&compose.spinbtn_undolevel,
prefs_set_data_from_spinbtn, prefs_set_spinbtn},
- {"linewrap_length", "74", &prefs_common.linewrap_len, P_INT,
- &compose.spinbtn_linewrap,
+ {"linewrap_length", "72", &prefs_common.linewrap_len, P_INT,
+ &compose.spinbtn_linewrap,
prefs_set_data_from_spinbtn, prefs_set_spinbtn},
{"linewrap_quotation", "FALSE", &prefs_common.linewrap_quote, P_BOOL,
&compose.checkbtn_wrapquote,
datefmt_clist = gtk_clist_new_with_titles(2, titles);
gtk_widget_show(datefmt_clist);
gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist);
-/* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
-
+ /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist),
GTK_SELECTION_BROWSE);
GtkWidget *tgt_folder_label;
GtkWidget *hbbox;
GtkWidget *ok_btn;
- //GtkWidget *cancel_btn;
GtkWidget *recycle_colors_btn;
GtkWidget *frame_colors;
static void prefs_filter_dest_radio_button_toggled (void);
static void prefs_filter_notrecv_radio_button_toggled (void);
+static void prefs_filter_regex_check_button_toggled (void);
static gint prefs_filter_deleted (GtkWidget *widget,
GdkEventAny *event,
NULL);
PACK_CHECK_BUTTON (dest_hbox, regex_chkbtn, _("Use regex"));
- gtk_widget_set_sensitive(regex_chkbtn, FALSE);
+ //gtk_widget_set_sensitive(regex_chkbtn, FALSE);
+ gtk_signal_connect
+ (GTK_OBJECT (regex_chkbtn), "toggled",
+ GTK_SIGNAL_FUNC (prefs_filter_regex_check_button_toggled),
+ NULL);
notrecv_radiobtn = gtk_radio_button_new_with_label
(recv_group, _("Don't receive"));
flt->body2 = g_strdup(entry_text);
}
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(filter.regex_chkbtn)))
+ flt->flag1 = flt->flag2 = FLT_REGEX;
+
GET_ENTRY(filter.pred_entry1);
if (!strcmp(entry_text, _("contains")))
- flt->flag1 = FLT_CONTAIN;
+ flt->flag1 |= FLT_CONTAIN;
GET_ENTRY(filter.pred_entry2);
if (!strcmp(entry_text, _("contains")))
- flt->flag2 = FLT_CONTAIN;
+ flt->flag2 |= FLT_CONTAIN;
GET_ENTRY(filter.op_entry);
if (!strcmp(entry_text, "and"))
Filter default_flt = {"Subject", NULL, _("(none)"), NULL,
FLT_CONTAIN, FLT_CONTAIN, FLT_AND,
NULL, FLT_MOVE};
+ gboolean is_regex;
flt = gtk_clist_get_row_data(clist, row);
if (!flt)
FLT_IS_CONTAIN(flt->flag2)
? _("contains") : _("not contain"));
+ is_regex = FLT_IS_REGEX(flt->flag1);
+ gtk_widget_set_sensitive(filter.pred_combo1, !is_regex);
+ gtk_widget_set_sensitive(filter.pred_combo2, !is_regex);
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON(filter.regex_chkbtn), is_regex);
+
gtk_entry_set_text(GTK_ENTRY(filter.op_entry),
flt->cond == FLT_OR ? "or" : "and");
if (flt->action == FLT_NOTRECV)
gtk_widget_set_sensitive(filter.destsel_btn, FALSE);
}
+static void prefs_filter_regex_check_button_toggled(void)
+{
+ gboolean is_regex;
+
+ is_regex = gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON(filter.regex_chkbtn));
+ gtk_widget_set_sensitive(filter.pred_combo1, !is_regex);
+ gtk_widget_set_sensitive(filter.pred_combo2, !is_regex);
+}
+
static gint prefs_filter_deleted(GtkWidget *widget, GdkEventAny *event,
gpointer data)
{
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ *
+ * This program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkpixmap.h>
+
+#include "stock_pixmap.h"
+#include "gtkutils.h"
+
+#include "pixmaps/address.xpm"
+#include "pixmaps/book.xpm"
+#include "pixmaps/category.xpm"
+#include "pixmaps/checkbox_off.xpm"
+#include "pixmaps/checkbox_on.xpm"
+#include "pixmaps/clip.xpm"
+#include "pixmaps/complete.xpm"
+#include "pixmaps/continue.xpm"
+#include "pixmaps/deleted.xpm"
+#include "pixmaps/dir-close.xpm"
+#include "pixmaps/dir-open.xpm"
+#include "pixmaps/error.xpm"
+#include "pixmaps/forwarded.xpm"
+#include "pixmaps/group.xpm"
+#include "pixmaps/inbox.xpm"
+#include "pixmaps/interface.xpm"
+#include "pixmaps/jpilot.xpm"
+#include "pixmaps/ldap.xpm"
+#include "pixmaps/linewrap.xpm"
+#include "pixmaps/mark.xpm"
+#include "pixmaps/new.xpm"
+#include "pixmaps/outbox.xpm"
+#include "pixmaps/replied.xpm"
+#include "pixmaps/stock_close.xpm"
+#include "pixmaps/stock_down_arrow.xpm"
+#include "pixmaps/stock_exec.xpm"
+#include "pixmaps/stock_mail.xpm"
+#include "pixmaps/stock_mail_attach.xpm"
+#include "pixmaps/stock_mail_compose.xpm"
+#include "pixmaps/stock_mail_forward.xpm"
+#include "pixmaps/stock_mail_receive.xpm"
+#include "pixmaps/stock_mail_receive_all.xpm"
+#include "pixmaps/stock_mail_reply.xpm"
+#include "pixmaps/stock_mail_reply_to_all.xpm"
+#include "pixmaps/stock_mail_reply_to_author.xpm"
+#include "pixmaps/stock_mail_send.xpm"
+#include "pixmaps/stock_mail_send_queue.xpm"
+#include "pixmaps/stock_news_compose.xpm"
+#include "pixmaps/stock_paste.xpm"
+#include "pixmaps/stock_preferences.xpm"
+#include "pixmaps/stock_properties.xpm"
+#include "pixmaps/sylpheed-logo.xpm"
+#include "pixmaps/tb_address_book.xpm"
+#include "pixmaps/trash.xpm"
+#include "pixmaps/unread.xpm"
+#include "pixmaps/vcard.xpm"
+
+typedef struct _StockPixmapData StockPixmapData;
+
+struct _StockPixmapData
+{
+ gchar **data;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+};
+
+static StockPixmapData pixmaps[] =
+{
+ {address_xpm , NULL, NULL},
+ {book_xpm , NULL, NULL},
+ {category_xpm , NULL, NULL},
+ {checkbox_off_xpm , NULL, NULL},
+ {checkbox_on_xpm , NULL, NULL},
+ {clip_xpm , NULL, NULL},
+ {complete_xpm , NULL, NULL},
+ {continue_xpm , NULL, NULL},
+ {deleted_xpm , NULL, NULL},
+ {dir_close_xpm , NULL, NULL},
+ {dir_open_xpm , NULL, NULL},
+ {error_xpm , NULL, NULL},
+ {forwarded_xpm , NULL, NULL},
+ {group_xpm , NULL, NULL},
+ {inbox_xpm , NULL, NULL},
+ {interface_xpm , NULL, NULL},
+ {jpilot_xpm , NULL, NULL},
+ {ldap_xpm , NULL, NULL},
+ {linewrap_xpm , NULL, NULL},
+ {mark_xpm , NULL, NULL},
+ {new_xpm , NULL, NULL},
+ {outbox_xpm , NULL, NULL},
+ {replied_xpm , NULL, NULL},
+ {stock_close_xpm , NULL, NULL},
+ {stock_down_arrow_xpm , NULL, NULL},
+ {stock_exec_xpm , NULL, NULL},
+ {stock_mail_xpm , NULL, NULL},
+ {stock_mail_attach_xpm , NULL, NULL},
+ {stock_mail_compose_xpm , NULL, NULL},
+ {stock_mail_forward_xpm , NULL, NULL},
+ {stock_mail_receive_xpm , NULL, NULL},
+ {stock_mail_receive_all_xpm , NULL, NULL},
+ {stock_mail_reply_xpm , NULL, NULL},
+ {stock_mail_reply_to_all_xpm , NULL, NULL},
+ {stock_mail_reply_to_author_xpm , NULL, NULL},
+ {stock_mail_send_xpm , NULL, NULL},
+ {stock_mail_send_queue_xpm , NULL, NULL},
+ {stock_news_compose_xpm , NULL, NULL},
+ {stock_paste_xpm , NULL, NULL},
+ {stock_preferences_xpm , NULL, NULL},
+ {stock_properties_xpm , NULL, NULL},
+ {sylpheed_logo_xpm , NULL, NULL},
+ {tb_address_book_xpm , NULL, NULL},
+ {trash_xpm , NULL, NULL},
+ {unread_xpm , NULL, NULL},
+ {vcard_xpm , NULL, NULL},
+};
+
+/* return newly constructed GtkPixmap from GdkPixmap */
+GtkWidget *stock_pixmap_widget(GtkWidget *window, StockPixmap icon)
+{
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ g_return_val_if_fail(window != NULL, NULL);
+ g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, NULL);
+
+ stock_pixmap_gdk(window, icon, &pixmap, &mask);
+ return gtk_pixmap_new(pixmap, mask);
+}
+
+/* create GdkPixmap if it has not created yet */
+gint stock_pixmap_gdk(GtkWidget *window, StockPixmap icon,
+ GdkPixmap **pixmap, GdkBitmap **mask)
+{
+ StockPixmapData *pix_d;
+
+ if (pixmap) *pixmap = NULL;
+ if (mask) *mask = NULL;
+
+ g_return_val_if_fail(window != NULL, -1);
+ g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
+
+ pix_d = &pixmaps[icon];
+
+ if (!pix_d->pixmap) {
+ PIXMAP_CREATE(window, pix_d->pixmap, pix_d->mask,
+ pix_d->data);
+ }
+
+ if (pixmap) *pixmap = pix_d->pixmap;
+ if (mask) *mask = pix_d->mask;
+
+ return 0;
+}
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ *
+ * This program 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 program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __STOCK_PIXMAP_H__
+#define __STOCK_PIXMAP_H__
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+typedef enum
+{
+ STOCK_PIXMAP_ADDRESS,
+ STOCK_PIXMAP_BOOK,
+ STOCK_PIXMAP_CATEGORY,
+ STOCK_PIXMAP_CHECKBOX_OFF,
+ STOCK_PIXMAP_CHECKBOX_ON,
+ STOCK_PIXMAP_CLIP,
+ STOCK_PIXMAP_COMPLETE,
+ STOCK_PIXMAP_CONTINUE,
+ STOCK_PIXMAP_DELETED,
+ STOCK_PIXMAP_DIR_CLOSE,
+ STOCK_PIXMAP_DIR_OPEN,
+ STOCK_PIXMAP_ERROR,
+ STOCK_PIXMAP_FORWARDED,
+ STOCK_PIXMAP_GROUP,
+ STOCK_PIXMAP_INBOX,
+ STOCK_PIXMAP_INTERFACE,
+ STOCK_PIXMAP_JPILOT,
+ STOCK_PIXMAP_LDAP,
+ STOCK_PIXMAP_LINEWRAP,
+ STOCK_PIXMAP_MARK,
+ STOCK_PIXMAP_NEW,
+ STOCK_PIXMAP_OUTBOX,
+ STOCK_PIXMAP_REPLIED,
+ STOCK_PIXMAP_CLOSE,
+ STOCK_PIXMAP_DOWN_ARROW,
+ STOCK_PIXMAP_EXEC,
+ STOCK_PIXMAP_MAIL,
+ STOCK_PIXMAP_MAIL_ATTACH,
+ STOCK_PIXMAP_MAIL_COMPOSE,
+ STOCK_PIXMAP_MAIL_FORWARD,
+ STOCK_PIXMAP_MAIL_RECEIVE,
+ STOCK_PIXMAP_MAIL_RECEIVE_ALL,
+ STOCK_PIXMAP_MAIL_REPLY,
+ STOCK_PIXMAP_MAIL_REPLY_TO_ALL,
+ STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR,
+ STOCK_PIXMAP_MAIL_SEND,
+ STOCK_PIXMAP_MAIL_SEND_QUEUE,
+ STOCK_PIXMAP_NEWS_COMPOSE,
+ STOCK_PIXMAP_PASTE,
+ STOCK_PIXMAP_PREFERENCES,
+ STOCK_PIXMAP_PROPERTIES,
+ STOCK_PIXMAP_SYLPHEED_LOGO,
+ STOCK_PIXMAP_ADDRESS_BOOK,
+ STOCK_PIXMAP_TRASH,
+ STOCK_PIXMAP_UNREAD,
+ STOCK_PIXMAP_VCARD,
+
+ N_STOCK_PIXMAPS
+} StockPixmap;
+
+GtkWidget *stock_pixmap_widget (GtkWidget *window,
+ StockPixmap icon);
+gint stock_pixmap_gdk (GtkWidget *window,
+ StockPixmap icon,
+ GdkPixmap **pixmap,
+ GdkBitmap **mask);
+
+#endif /* __STOCK_PIXMAP_H__ */
#include "compose.h"
#include "utils.h"
#include "gtkutils.h"
+#include "stock_pixmap.h"
#include "filesel.h"
#include "manage_window.h"
#include "alertpanel.h"
#include "prefs_folder_item.h"
#include "filtering.h"
-#include "pixmaps/dir-open.xpm"
-#include "pixmaps/mark.xpm"
-#include "pixmaps/deleted.xpm"
-#include "pixmaps/new.xpm"
-#include "pixmaps/unread.xpm"
-#include "pixmaps/replied.xpm"
-#include "pixmaps/forwarded.xpm"
-#include "pixmaps/clip.xpm"
-#include "pixmaps/ignorethread.xpm"
-#include "pixmaps/locked.xpm"
-
#define STATUSBAR_PUSH(mainwin, str) \
{ \
gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \
static GtkStyle *small_marked_style;
static GtkStyle *small_deleted_style;
-static GdkPixmap *folderxpm;
-static GdkBitmap *folderxpmmask;
-
static GdkPixmap *markxpm;
static GdkBitmap *markxpmmask;
static GdkPixmap *deletedxpm;
GtkStyle *style;
GtkWidget *pixmap;
- PIXMAP_CREATE(summaryview->ctree, markxpm, markxpmmask, mark_xpm);
- PIXMAP_CREATE(summaryview->ctree, deletedxpm, deletedxpmmask,
- deleted_xpm);
- PIXMAP_CREATE(summaryview->ctree, newxpm, newxpmmask, new_xpm);
- PIXMAP_CREATE(summaryview->ctree, unreadxpm, unreadxpmmask, unread_xpm);
- PIXMAP_CREATE(summaryview->ctree, repliedxpm, repliedxpmmask,
- replied_xpm);
- PIXMAP_CREATE(summaryview->ctree, forwardedxpm, forwardedxpmmask,
- forwarded_xpm);
- PIXMAP_CREATE(summaryview->ctree, ignorethreadxpm, ignorethreadxpmmask,
- ignorethread_xpm);
- PIXMAP_CREATE(summaryview->ctree, lockedxpm, lockedxpmmask, locked_xpm);
- PIXMAP_CREATE(summaryview->ctree, clipxpm, clipxpmmask, clip_xpm);
- PIXMAP_CREATE(summaryview->hbox, folderxpm, folderxpmmask,
- dir_open_xpm);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
+ &markxpm, &markxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_DELETED,
+ &deletedxpm, &deletedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_NEW,
+ &newxpm, &newxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_UNREAD,
+ &unreadxpm, &unreadxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_REPLIED,
+ &repliedxpm, &repliedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_FORWARDED,
+ &forwardedxpm, &forwardedxpmmask);
+ stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP,
+ &clipxpm, &clipxpmmask);
if (!small_style) {
small_style = gtk_style_copy
gtk_widget_set_style(summaryview->statlabel_select, style);
gtk_widget_set_style(summaryview->statlabel_msgs, style);
- pixmap = gtk_pixmap_new(folderxpm, folderxpmmask);
+ pixmap = stock_pixmap_widget(summaryview->hbox, STOCK_PIXMAP_DIR_OPEN);
gtk_box_pack_start(GTK_BOX(summaryview->hbox), pixmap, FALSE, FALSE, 4);
gtk_box_reorder_child(GTK_BOX(summaryview->hbox), pixmap, 0);
gtk_widget_show(pixmap);
#include <ldap.h>
#include <lber.h>
#include <pthread.h>
-#include <dlfcn.h>
+/* #include <dlfcn.h> */
#include "mgutils.h"
#include "addritem.h"
* Test whether LDAP libraries installed.
* Return: TRUE if library available.
*/
+#if 0
gboolean syldap_test_ldap_lib() {
void *handle, *fun;
return TRUE;
}
+#endif /* 0 */
#endif /* USE_LDAP */
GList *syldap_read_basedn ( SyldapServer *ldapServer );
gboolean syldap_test_connect_s ( const gchar *host, const gint port );
gboolean syldap_test_connect ( SyldapServer *ldapServer );
-gboolean syldap_test_ldap_lib ( void );
+/* gboolean syldap_test_ldap_lib ( void ); */
#endif /* USE_LDAP */
if (!is_dir_exist(path)) {
if (is_file_exist(path)) {
- g_warning(_("file %s allready exists\n"), path);
+ g_warning(_("file %s already exists\n"), path);
return;
}
if (mkdir(path, S_IRWXU) < 0) {
#endif
#include <glib.h>
+#include "gtkstext.h"
#include <string.h> /* for strlen */
#include <stdlib.h> /* for mbstowcs */
#include "undo.h"
#include "utils.h"
-#include "gtkstext.h"
#include "prefs_common.h"
typedef struct _UndoInfo UndoInfo;
gchar *text;
gint start_pos;
gint end_pos;
- float window_position;
- int mergeable;
+ gfloat window_position;
+ gint mergeable;
};
static void undo_free_list (GList **list_pointer);
{
UndoInfo *undoinfo;
undoinfo = g_new (UndoInfo, 1);
- undoinfo->text = text;
- undoinfo->start_pos = start_pos;
- undoinfo->end_pos = end_pos;
- undoinfo->action = action;
+ undoinfo->text = text;
+ undoinfo->start_pos = start_pos;
+ undoinfo->end_pos = end_pos;
+ undoinfo->action = action;
undoinfo->window_position = window_position;
return undoinfo;
}
**/
static void undo_free_list(GList **list_pointer)
{
- UndoInfo *nth_redo;
- GList *cur, *list = *list_pointer;
-
- if (list == NULL)
- return;
+ UndoInfo *undo;
+ GList *cur, *list = *list_pointer;
- debug_print("length of list: %d\n", g_list_length(list));
+ if (list == NULL) return;
for (cur = list; cur != NULL; cur = cur->next) {
- nth_redo = cur->data;
- undo_object_free(nth_redo);
+ undo = (UndoInfo *)cur->data;
+ undo_object_free(undo);
}
- g_list_free(list);
+ g_list_free(list);
*list_pointer = NULL;
}
-void undo_set_undo_change_funct(UndoMain *undostruct, UndoChangeState func,
- GtkWidget *changewidget)
+void undo_set_change_state_func(UndoMain *undostruct, UndoChangeStateFunc func,
+ gpointer data)
{
- g_return_if_fail(undostruct != NULL);
- undostruct->change_func = func;
- undostruct->changewidget = changewidget;
+ g_return_if_fail(undostruct != NULL);
+
+ undostruct->change_state_func = func;
+ undostruct->change_state_data = data;
}
/**
**/
static void undo_check_size(UndoMain *undostruct)
{
- UndoInfo *nth_undo;
-
- if (prefs_common.undolevels < 1)
- return;
-
- /* No need to check for the redo list size since the undo
- list gets freed on any call to compose_undo_add */
- if (g_list_length(undostruct->undo) >= prefs_common.undolevels && prefs_common.undolevels > 0) {
- nth_undo = g_list_nth_data(undostruct->undo, g_list_length(undostruct->undo) - 1);
- undostruct->undo = g_list_remove(undostruct->undo, nth_undo);
- g_free (nth_undo->text);
- g_free (nth_undo);
- }
- debug_print("g_list_length (undostruct->undo): %d\n", g_list_length(undostruct->undo));
+ UndoInfo *last_undo;
+ guint length;
+
+ if (prefs_common.undolevels < 1) return;
+
+ /* No need to check for the redo list size since the undo
+ list gets freed on any call to compose_undo_add */
+ length = g_list_length(undostruct->undo);
+ if (length >= prefs_common.undolevels && prefs_common.undolevels > 0) {
+ last_undo = (UndoInfo *)g_list_last(undostruct->undo)->data;
+ undostruct->undo = g_list_remove(undostruct->undo, last_undo);
+ undo_object_free(last_undo);
+ }
+ debug_print("g_list_length(undostruct->undo): %d\n", length);
}
/**
*
* Return Value: TRUE is merge was sucessful, FALSE otherwise
**/
-static gint undo_merge (GList *list, guint start_pos, guint end_pos, gint action, const guchar* text)
+static gint undo_merge(GList *list, guint start_pos, guint end_pos,
+ gint action, const guchar *text)
{
- guchar *temp_string;
- UndoInfo *last_undo;
- gboolean checkit = TRUE;
-
- /* This are the cases in which we will NOT merge :
- 1. if (last_undo->mergeable == FALSE)
- [mergeable = FALSE when the size of the undo data was not 1.
- or if the data was size = 1 but = '\n' or if the undo object
- has been "undone" already ]
- 2. The size of text is not 1
- 3. If the new merging data is a '\n'
- 4. If the last char of the undo_last data is a space/tab
- and the new char is not a space/tab ( so that we undo
- words and not chars )
- 5. If the type (action) of undo is different from the last one
- Chema */
-
- if (list == NULL)
- return FALSE;
-
- last_undo = list->data;
-
- if (!last_undo->mergeable)
- return FALSE;
-
- if (end_pos-start_pos != 1) {
- last_undo->mergeable = FALSE;
- return FALSE;
- }
-
- if (text[0] == '\n')
- checkit = FALSE;
-
- if (action != last_undo->action)
- checkit = FALSE;
-
- if (action == UNDO_ACTION_REPLACE_INSERT || action == UNDO_ACTION_REPLACE_DELETE)
- checkit = FALSE;
-
- if (action == UNDO_ACTION_DELETE && checkit) {
- if (last_undo->start_pos!=end_pos && last_undo->start_pos != start_pos && checkit)
- checkit = FALSE;
-
- if (last_undo->start_pos == start_pos && checkit) {
- /* Deleted with the delete key */
- if ( text[0] != ' ' && text[0] != '\t' && checkit &&
- (last_undo->text[last_undo->end_pos-last_undo->start_pos - 1] == ' '
- || last_undo->text[last_undo->end_pos-last_undo->start_pos - 1] == '\t'))
- checkit = FALSE;
-
- temp_string = g_strdup_printf("%s%s", last_undo->text, text);
- g_free(last_undo->text);
- last_undo->end_pos += 1;
- last_undo->text = temp_string;
- } else if (checkit) {
- /* Deleted with the backspace key */
- if ( text[0] != ' ' && text[0] != '\t' && checkit &&
- (last_undo->text[0] == ' '
- || last_undo->text[0] == '\t'))
- checkit = FALSE;
-
- temp_string = g_strdup_printf("%s%s", text, last_undo->text);
- g_free(last_undo->text);
- last_undo->start_pos = start_pos;
- last_undo->text = temp_string;
+ guchar *temp_string;
+ UndoInfo *last_undo;
+
+ /* This are the cases in which we will NOT merge :
+ 1. if (last_undo->mergeable == FALSE)
+ [mergeable = FALSE when the size of the undo data was not 1.
+ or if the data was size = 1 but = '\n' or if the undo object
+ has been "undone" already ]
+ 2. The size of text is not 1
+ 3. If the new merging data is a '\n'
+ 4. If the last char of the undo_last data is a space/tab
+ and the new char is not a space/tab ( so that we undo
+ words and not chars )
+ 5. If the type (action) of undo is different from the last one
+ Chema */
+
+ if (list == NULL) return FALSE;
+
+ last_undo = list->data;
+
+ if (!last_undo->mergeable) return FALSE;
+
+ if (end_pos - start_pos != 1 ||
+ text[0] == '\n' ||
+ action != last_undo->action ||
+ action == UNDO_ACTION_REPLACE_INSERT ||
+ action == UNDO_ACTION_REPLACE_DELETE) {
+ last_undo->mergeable = FALSE;
+ return FALSE;
+ }
+
+ if (action == UNDO_ACTION_DELETE) {
+ gboolean checkit = TRUE;
+
+ if (last_undo->start_pos != end_pos &&
+ last_undo->start_pos != start_pos) {
+ last_undo->mergeable = FALSE;
+ return FALSE;
+ } else if (last_undo->start_pos == start_pos) {
+ /* Deleted with the delete key */
+ if (text[0] != ' ' && text[0] != '\t' &&
+ (last_undo->text[last_undo->end_pos - last_undo->start_pos - 1] == ' ' ||
+ last_undo->text[last_undo->end_pos - last_undo->start_pos - 1] == '\t'))
+ checkit = FALSE;
+
+ temp_string = g_strdup_printf("%s%s", last_undo->text, text);
+ last_undo->end_pos++;
+ g_free(last_undo->text);
+ last_undo->text = temp_string;
+ } else {
+ /* Deleted with the backspace key */
+ if (text[0] != ' ' && text[0] != '\t' &&
+ (last_undo->text[0] == ' ' ||
+ last_undo->text[0] == '\t'))
+ checkit = FALSE;
+
+ temp_string = g_strdup_printf("%s%s", text, last_undo->text);
+ last_undo->start_pos = start_pos;
+ g_free(last_undo->text);
+ last_undo->text = temp_string;
}
- } else if (action == UNDO_ACTION_INSERT && checkit) {
- if (last_undo->end_pos != start_pos && checkit)
- checkit = FALSE;
-
-/* if ( text[0]!=' ' && text[0]!='\t' &&
- (last_undo->text [last_undo->end_pos-last_undo->start_pos - 1] ==' '
- || last_undo->text [last_undo->end_pos-last_undo->start_pos - 1] == '\t'))
- goto compose_undo_do_not_merge;
-*/
- if (checkit) {
+
+ if (!checkit) {
+ last_undo->mergeable = FALSE;
+ return FALSE;
+ }
+ } else if (action == UNDO_ACTION_INSERT) {
+ if (last_undo->end_pos != start_pos) {
+ last_undo->mergeable = FALSE;
+ return FALSE;
+ } else {
temp_string = g_strdup_printf("%s%s", last_undo->text, text);
- g_free(last_undo->text);
- last_undo->end_pos = end_pos;
- last_undo->text = temp_string;
+ g_free(last_undo->text);
+ last_undo->end_pos = end_pos;
+ last_undo->text = temp_string;
}
- } else if (checkit)
- debug_print("Unknown action [%i] inside undo merge encountered", action);
+ } else
+ debug_print("Unknown action [%i] inside undo merge encountered", action);
- if (checkit) {
- debug_print("Merged: %s\n", text);
- return TRUE;
- } else {
- last_undo->mergeable = FALSE;
- return FALSE;
- }
+ debug_print("Merged: %s\n", text);
+ return TRUE;
}
/**
gint start_pos, gint end_pos,
UndoAction action, UndoMain *undostruct)
{
- UndoInfo *undoinfo;
+ UndoInfo *undoinfo;
- debug_print("undo_add(%i)*%s*\n", strlen (text), text);
+ debug_print("undo_add(%i)*%s*\n", strlen (text), text);
g_return_if_fail(text != NULL);
- g_return_if_fail(end_pos >= start_pos);
+ g_return_if_fail(end_pos >= start_pos);
- undo_free_list(&undostruct->redo);
+ undo_free_list(&undostruct->redo);
- /* Set the redo sensitivity */
- undostruct->change_func(undostruct, UNDO_STATE_UNCHANGED, UNDO_STATE_FALSE,
- undostruct->changewidget);
+ /* Set the redo sensitivity */
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_UNCHANGED, UNDO_STATE_FALSE,
+ undostruct->change_state_data);
if (undostruct->paste != 0) {
if (action == UNDO_ACTION_INSERT)
undostruct->paste = 0;
}
- if (undo_merge(undostruct->undo, start_pos, end_pos, action, text))
- return;
+ if (undo_merge(undostruct->undo, start_pos, end_pos, action, text))
+ return;
undo_check_size(undostruct);
undoinfo = undo_object_new(g_strdup(text), start_pos, end_pos, action,
GTK_ADJUSTMENT(GTK_STEXT(undostruct->text)->vadj)->value);
- if (end_pos-start_pos != 1 || text[0] == '\n')
- undoinfo->mergeable = FALSE;
- else
- undoinfo->mergeable = TRUE;
+ if (end_pos - start_pos != 1 || text[0] == '\n')
+ undoinfo->mergeable = FALSE;
+ else
+ undoinfo->mergeable = TRUE;
undostruct->undo = g_list_prepend(undostruct->undo, undoinfo);
- undostruct->change_func(undostruct, UNDO_STATE_TRUE, UNDO_STATE_UNCHANGED, undostruct->changewidget);
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_TRUE, UNDO_STATE_UNCHANGED,
+ undostruct->change_state_data);
}
/**
void undo_undo(UndoMain *undostruct)
{
UndoInfo *undoinfo;
- guint start_pos, end_pos;
-
- if (undostruct->undo == NULL)
- return;
+ guint start_pos, end_pos;
g_return_if_fail(undostruct != NULL);
+ if (undostruct->undo == NULL) return;
/* The undo data we need is always at the top op the
stack. So, therefore, the first one */
- undoinfo = g_list_nth_data(undostruct->undo, 0);
+ undoinfo = (UndoInfo *)undostruct->undo->data;
g_return_if_fail(undoinfo != NULL);
undoinfo->mergeable = FALSE;
undostruct->redo = g_list_prepend(undostruct->redo, undoinfo);
undostruct->undo = g_list_remove(undostruct->undo, undoinfo);
/* Check if there is a selection active */
- start_pos = GTK_EDITABLE(undostruct->text)->selection_start_pos;
- end_pos = GTK_EDITABLE(undostruct->text)->selection_end_pos;
+ start_pos = GTK_EDITABLE(undostruct->text)->selection_start_pos;
+ end_pos = GTK_EDITABLE(undostruct->text)->selection_end_pos;
if ((start_pos > 0 || end_pos > 0) && (start_pos != end_pos))
- gtk_editable_select_region(GTK_EDITABLE(undostruct->text), 0, 0);
+ gtk_editable_select_region(GTK_EDITABLE(undostruct->text),
+ 0, 0);
/* Move the view (scrollbars) to the correct position */
- gtk_adjustment_set_value(GTK_ADJUSTMENT(GTK_STEXT(undostruct->text)->vadj), undoinfo->window_position);
+ gtk_adjustment_set_value
+ (GTK_ADJUSTMENT(GTK_STEXT(undostruct->text)->vadj),
+ undoinfo->window_position);
switch (undoinfo->action) {
case UNDO_ACTION_DELETE:
gtk_stext_backward_delete(GTK_STEXT(undostruct->text), undoinfo->end_pos-undoinfo->start_pos);
debug_print("UNDO_ACTION_INSERT %d\n", undoinfo->end_pos-undoinfo->start_pos);
break;
- case UNDO_ACTION_REPLACE_INSERT:
+ case UNDO_ACTION_REPLACE_INSERT:
gtk_stext_set_point(GTK_STEXT(undostruct->text), undoinfo->end_pos);
gtk_stext_backward_delete(GTK_STEXT(undostruct->text), undoinfo->end_pos-undoinfo->start_pos);
debug_print("UNDO_ACTION_REPLACE %s\n", undoinfo->text);
- /* "pull" another data structure from the list */
- undoinfo = g_list_nth_data(undostruct->undo, 0);
- g_return_if_fail(undoinfo != NULL);
- undostruct->redo = g_list_prepend(undostruct->redo, undoinfo);
- undostruct->undo = g_list_remove(undostruct->undo, undoinfo);
- g_return_if_fail(undoinfo->action == UNDO_ACTION_REPLACE_DELETE);
+ /* "pull" another data structure from the list */
+ undoinfo = (UndoInfo *)undostruct->undo->data;
+ g_return_if_fail(undoinfo != NULL);
+ undostruct->redo = g_list_prepend(undostruct->redo, undoinfo);
+ undostruct->undo = g_list_remove(undostruct->undo, undoinfo);
+ g_return_if_fail(undoinfo->action == UNDO_ACTION_REPLACE_DELETE);
gtk_stext_set_point(GTK_STEXT(undostruct->text), undoinfo->start_pos);
gtk_stext_insert(GTK_STEXT(undostruct->text), NULL, NULL, NULL, undoinfo->text, -1);
debug_print("UNDO_ACTION_REPLACE %s\n", undoinfo->text);
- break;
- case UNDO_ACTION_REPLACE_DELETE:
- g_warning("This should not happen. UNDO_REPLACE_DELETE");
- break;
+ break;
+ case UNDO_ACTION_REPLACE_DELETE:
+ g_warning("This should not happen. UNDO_REPLACE_DELETE");
+ break;
default:
g_assert_not_reached();
break;
}
- undostruct->change_func(undostruct, UNDO_STATE_UNCHANGED,
- UNDO_STATE_TRUE, undostruct->changewidget);
-
- if (g_list_length (undostruct->undo) == 0)
- undostruct->change_func(undostruct, UNDO_STATE_FALSE,
- UNDO_STATE_UNCHANGED,
- undostruct->changewidget);
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_UNCHANGED, UNDO_STATE_TRUE,
+ undostruct->change_state_data);
+
+ if (undostruct->undo == NULL)
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_FALSE,
+ UNDO_STATE_UNCHANGED,
+ undostruct->change_state_data);
}
/**
void undo_redo(UndoMain *undostruct)
{
UndoInfo *redoinfo;
- guint start_pos, end_pos;
+ guint start_pos, end_pos;
- if (undostruct->redo == NULL)
- return;
+ g_return_if_fail(undostruct != NULL);
- if (undostruct==NULL)
- return;
+ if (undostruct->redo == NULL) return;
- redoinfo = g_list_nth_data(undostruct->redo, 0);
- g_return_if_fail (redoinfo!=NULL);
+ redoinfo = (UndoInfo *)undostruct->redo->data;
+ g_return_if_fail (redoinfo != NULL);
undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
undostruct->redo = g_list_remove(undostruct->redo, redoinfo);
/* Check if there is a selection active */
- start_pos = GTK_EDITABLE(undostruct->text)->selection_start_pos;
- end_pos = GTK_EDITABLE(undostruct->text)->selection_end_pos;
+ start_pos = GTK_EDITABLE(undostruct->text)->selection_start_pos;
+ end_pos = GTK_EDITABLE(undostruct->text)->selection_end_pos;
if ((start_pos > 0 || end_pos > 0) && (start_pos != end_pos))
gtk_editable_select_region(GTK_EDITABLE(undostruct->text), 0, 0);
switch (redoinfo->action) {
case UNDO_ACTION_INSERT:
- gtk_stext_set_point(GTK_STEXT(undostruct->text), redoinfo->start_pos);
+ gtk_stext_set_point(GTK_STEXT(undostruct->text),
+ redoinfo->start_pos);
gtk_stext_insert(GTK_STEXT(undostruct->text), NULL, NULL,
- NULL, redoinfo->text, -1);
+ NULL, redoinfo->text, -1);
debug_print("UNDO_ACTION_DELETE %s\n",redoinfo->text);
break;
case UNDO_ACTION_DELETE:
- gtk_stext_set_point(GTK_STEXT(undostruct->text), redoinfo->end_pos);
- gtk_stext_backward_delete(GTK_STEXT(undostruct->text),
- redoinfo->end_pos-redoinfo->start_pos);
+ gtk_stext_set_point(GTK_STEXT(undostruct->text),
+ redoinfo->end_pos);
+ gtk_stext_backward_delete
+ (GTK_STEXT(undostruct->text),
+ redoinfo->end_pos - redoinfo->start_pos);
debug_print("UNDO_ACTION_INSERT %d\n",
redoinfo->end_pos-redoinfo->start_pos);
break;
- case UNDO_ACTION_REPLACE_DELETE:
- gtk_stext_set_point(GTK_STEXT(undostruct->text), redoinfo->end_pos);
- gtk_stext_backward_delete(GTK_STEXT(undostruct->text),
- redoinfo->end_pos-redoinfo->start_pos);
- /* "pull" another data structure from the list */
- redoinfo = g_list_nth_data(undostruct->redo, 0);
- g_return_if_fail(redoinfo != NULL);
- undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
- undostruct->redo = g_list_remove(undostruct->redo, redoinfo);
- g_return_if_fail(redoinfo->action==UNDO_ACTION_REPLACE_INSERT);
- gtk_stext_set_point(GTK_STEXT(undostruct->text), redoinfo->start_pos);
+ case UNDO_ACTION_REPLACE_DELETE:
+ gtk_stext_set_point(GTK_STEXT(undostruct->text),
+ redoinfo->end_pos);
+ gtk_stext_backward_delete
+ (GTK_STEXT(undostruct->text),
+ redoinfo->end_pos - redoinfo->start_pos);
+ /* "pull" another data structure from the list */
+ redoinfo = (UndoInfo *)undostruct->redo->data;
+ g_return_if_fail(redoinfo != NULL);
+ undostruct->undo = g_list_prepend(undostruct->undo, redoinfo);
+ undostruct->redo = g_list_remove(undostruct->redo, redoinfo);
+ g_return_if_fail(redoinfo->action == UNDO_ACTION_REPLACE_INSERT);
+ gtk_stext_set_point(GTK_STEXT(undostruct->text),
+ redoinfo->start_pos);
gtk_stext_insert(GTK_STEXT(undostruct->text), NULL, NULL,
- NULL, redoinfo->text, -1);
- break;
- case UNDO_ACTION_REPLACE_INSERT:
- g_warning("This should not happen. Redo: UNDO_REPLACE_INSERT");
- break;
+ NULL, redoinfo->text, -1);
+ break;
+ case UNDO_ACTION_REPLACE_INSERT:
+ g_warning("This should not happen. Redo: UNDO_REPLACE_INSERT");
+ break;
default:
g_assert_not_reached();
break;
}
- undostruct->change_func(undostruct, UNDO_STATE_TRUE, UNDO_STATE_UNCHANGED,
- undostruct->changewidget);
-
- if (g_list_length(undostruct->redo) == 0)
- undostruct->change_func(undostruct, UNDO_STATE_UNCHANGED,
- UNDO_STATE_FALSE, undostruct->changewidget);
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_TRUE, UNDO_STATE_UNCHANGED,
+ undostruct->change_state_data);
+
+ if (undostruct->redo == NULL)
+ undostruct->change_state_func(undostruct,
+ UNDO_STATE_UNCHANGED,
+ UNDO_STATE_FALSE,
+ undostruct->change_state_data);
}
void undo_insert_text_cb(GtkEditable *editable, gchar *new_text,
void undo_delete_text_cb(GtkEditable *editable, gint start_pos,
gint end_pos, UndoMain *undostruct)
{
- gchar *text_to_delete;
+ gchar *text_to_delete;
if (prefs_common.undolevels <= 0) return;
if (start_pos == end_pos) return;
- text_to_delete = gtk_editable_get_chars(GTK_EDITABLE(editable),
+ text_to_delete = gtk_editable_get_chars(GTK_EDITABLE(editable),
start_pos, end_pos);
undo_add(text_to_delete, start_pos, end_pos, UNDO_ACTION_DELETE,
undostruct);
g_free(text_to_delete);
}
-void undo_paste_clipboard_cb (GtkEditable *editable, UndoMain *undostruct)
+void undo_paste_clipboard_cb(GtkEditable *editable, UndoMain *undostruct)
{
- debug_print("befor Paste: %d\n", undostruct->paste);
- if (prefs_common.undolevels > 0)
+ if (editable->clipboard_text == NULL) return;
+
+ debug_print("before Paste: %d\n", undostruct->paste);
+ if (prefs_common.undolevels > 0)
if (undo_get_selection(editable, NULL, NULL))
undostruct->paste = TRUE;
debug_print("after Paste: %d\n", undostruct->paste);
**/
static gint undo_get_selection(GtkEditable *text, guint *start, guint *end)
{
- guint start_pos, end_pos;
+ guint start_pos, end_pos;
- start_pos = text->selection_start_pos;
- end_pos = text->selection_end_pos;
+ start_pos = text->selection_start_pos;
+ end_pos = text->selection_end_pos;
- /* The user can select from end to start too. If so, swap it*/
- if (end_pos < start_pos) {
- guint swap_pos;
- swap_pos = end_pos;
- end_pos = start_pos;
- start_pos = swap_pos;
- }
+ /* The user can select from end to start too. If so, swap it*/
+ if (end_pos < start_pos) {
+ guint swap_pos;
+ swap_pos = end_pos;
+ end_pos = start_pos;
+ start_pos = swap_pos;
+ }
- if (start != NULL)
- *start = start_pos;
+ if (start != NULL)
+ *start = start_pos;
- if (end != NULL)
- *end = end_pos;
+ if (end != NULL)
+ *end = end_pos;
- if ((start_pos > 0 || end_pos > 0) && (start_pos != end_pos))
- return TRUE;
- else
- return FALSE;
+ if ((start_pos > 0 || end_pos > 0) && (start_pos != end_pos))
+ return TRUE;
+ else
+ return FALSE;
}
typedef struct _UndoMain UndoMain;
-typedef void (*UndoChangeState) (UndoMain *undostruct,
- gint undo_state,
- gint redo_state,
- GtkWidget *changewidget);
+typedef void (*UndoChangeStateFunc) (UndoMain *undostruct,
+ gint undo_state,
+ gint redo_state,
+ gpointer data);
struct _UndoMain
{
GtkWidget *text;
- GtkWidget *changewidget;
+
GList *undo;
GList *redo;
- UndoChangeState change_func;
+
+ UndoChangeStateFunc change_state_func;
+ gpointer change_state_data;
+
gboolean undo_state : 1;
gboolean redo_state : 1;
+
gint paste;
};
-UndoMain *undo_init (GtkWidget *text);
-void undo_destroy (UndoMain *undostruct);
-void undo_set_undo_change_funct (UndoMain *undostruct,
- UndoChangeState func,
- GtkWidget *changewidget);
+UndoMain *undo_init (GtkWidget *text);
+void undo_destroy (UndoMain *undostruct);
+
+void undo_set_change_state_func (UndoMain *undostruct,
+ UndoChangeStateFunc func,
+ gpointer data);
-void undo_undo (UndoMain *undostruct);
-void undo_redo (UndoMain *undostruct);
+void undo_undo (UndoMain *undostruct);
+void undo_redo (UndoMain *undostruct);
#endif /* __UNDO_H__ */
* Param: cardFile - object.
* Param: tagvalue - will be placed into the linked list.
*/
-static gchar *vcard_read_qp( VCardFile *cardFile, char *tagvalue ) {
+static gchar *vcard_read_qp( VCardFile *cardFile, gchar *tagvalue ) {
GSList *listQP = NULL;
gint len = 0;
gchar *line = tagvalue;
+
while( line ) {
listQP = g_slist_append( listQP, line );
len = strlen( line ) - 1;
* Parse tag name from line buffer.
* Return: Buffer containing the tag name, or NULL if no delimiter char found.
*/
-static gchar *vcard_get_tagname( char* line, gchar dlm ) {
+static gchar *vcard_get_tagname( gchar* line, gchar dlm ) {
gint len = 0;
gchar *tag = NULL;
gchar *lptr = line;
+
while( *lptr++ ) {
if( *lptr == dlm ) {
len = lptr - line;
/* GSList *listQP = NULL; */
for( ;; ) {
- gchar *line = vcard_get_line( cardFile );
+ gchar *line;
+
+ line = vcard_get_line( cardFile );
if( line == NULL ) break;
/* fprintf( stdout, "%s\n", line ); */
/* Parse line */
tagtemp = vcard_get_tagname( line, VCARD_SEP_TAG );
- if( tagtemp ) {
- /* fprintf( stdout, "\ttemp: %s\n", tagtemp ); */
- tagvalue = vcard_get_tagvalue( line, VCARD_SEP_TAG );
- tagname = vcard_get_tagname( tagtemp, VCARD_SEP_TYPE );
- tagtype = vcard_get_tagvalue( tagtemp, VCARD_SEP_TYPE );
- if( tagname == NULL ) {
- tagname = tagtemp;
- tagtemp = NULL;
- }
+ if( tagtemp == NULL ) {
+ g_free( line );
+ continue;
+ }
- /* fprintf( stdout, "\tname: %s\n", tagname ); */
- /* fprintf( stdout, "\ttype: %s\n", tagtype ); */
- /* fprintf( stdout, "\tvalue: %s\n", tagvalue ); */
+ /* fprintf( stdout, "\ttemp: %s\n", tagtemp ); */
- if( tagvalue ) {
- if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) {
- /* Quoted-Printable: could span multiple lines */
- tagvalue = vcard_read_qp( cardFile, tagvalue );
- vcard_unescape_qp( tagvalue );
- /* fprintf( stdout, "QUOTED-PRINTABLE !!! final\n>%s<\n", tagvalue ); */
- }
+ tagvalue = vcard_get_tagvalue( line, VCARD_SEP_TAG );
+ if( tagvalue == NULL ) {
+ g_free( tagtemp );
+ g_free( line );
+ continue;
+ }
- if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 &&
- g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
- /* fprintf( stdout, "start card\n" ); */
- vcard_free_lists( listName, listAddress, listRemarks, listID );
- listName = listAddress = listRemarks = listID = NULL;
- }
- if( g_strcasecmp( tagname, VCARD_TAG_FULLNAME ) == 0 ) {
- /* fprintf( stdout, "- full name: %s\n", tagvalue ); */
- listName = g_slist_append( listName, g_strdup( tagvalue ) );
- }
- if( g_strcasecmp( tagname, VCARD_TAG_EMAIL ) == 0 ) {
- /* fprintf( stdout, "- address: %s\n", tagvalue ); */
- listAddress = g_slist_append( listAddress, g_strdup( tagvalue ) );
- listRemarks = g_slist_append( listRemarks, g_strdup( tagtype ) );
- }
- if( g_strcasecmp( tagname, VCARD_TAG_UID ) == 0 ) {
- /* fprintf( stdout, "- id: %s\n", tagvalue ); */
- listID = g_slist_append( listID, g_strdup( tagvalue ) );
- }
- if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 &&
- g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
- /* vCard is complete */
- /* fprintf( stdout, "end card\n--\n" ); */
- /* vcard_dump_lists( listName, listAddress, listRemarks, listID, stdout ); */
- vcard_build_items( cardFile, listName, listAddress, listRemarks, listID );
- vcard_free_lists( listName, listAddress, listRemarks, listID );
- listName = listAddress = listRemarks = listID = NULL;
- }
- g_free( tagvalue );
- }
- g_free( tagname );
- g_free( tagtype );
+ tagname = vcard_get_tagname( tagtemp, VCARD_SEP_TYPE );
+ tagtype = vcard_get_tagvalue( tagtemp, VCARD_SEP_TYPE );
+ if( tagname == NULL ) {
+ tagname = tagtemp;
+ tagtemp = NULL;
+ }
+
+ /* fprintf( stdout, "\tname: %s\n", tagname ); */
+ /* fprintf( stdout, "\ttype: %s\n", tagtype ); */
+ /* fprintf( stdout, "\tvalue: %s\n", tagvalue ); */
+
+ if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) {
+ /* Quoted-Printable: could span multiple lines */
+ tagvalue = vcard_read_qp( cardFile, tagvalue );
+ vcard_unescape_qp( tagvalue );
+ /* fprintf( stdout, "QUOTED-PRINTABLE !!! final\n>%s<\n", tagvalue ); */
+ }
+
+ if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 &&
+ g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
+ /* fprintf( stdout, "start card\n" ); */
+ vcard_free_lists( listName, listAddress, listRemarks, listID );
+ listName = listAddress = listRemarks = listID = NULL;
+ }
+ if( g_strcasecmp( tagname, VCARD_TAG_FULLNAME ) == 0 ) {
+ /* fprintf( stdout, "- full name: %s\n", tagvalue ); */
+ listName = g_slist_append( listName, g_strdup( tagvalue ) );
+ }
+ if( g_strcasecmp( tagname, VCARD_TAG_EMAIL ) == 0 ) {
+ /* fprintf( stdout, "- address: %s\n", tagvalue ); */
+ listAddress = g_slist_append( listAddress, g_strdup( tagvalue ) );
+ listRemarks = g_slist_append( listRemarks, g_strdup( tagtype ) );
+ }
+ if( g_strcasecmp( tagname, VCARD_TAG_UID ) == 0 ) {
+ /* fprintf( stdout, "- id: %s\n", tagvalue ); */
+ listID = g_slist_append( listID, g_strdup( tagvalue ) );
}
+ if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 &&
+ g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
+ /* vCard is complete */
+ /* fprintf( stdout, "end card\n--\n" ); */
+ /* vcard_dump_lists( listName, listAddress, listRemarks, listID, stdout ); */
+ vcard_build_items( cardFile, listName, listAddress, listRemarks, listID );
+ vcard_free_lists( listName, listAddress, listRemarks, listID );
+ listName = listAddress = listRemarks = listID = NULL;
+ }
+
+ g_free( tagname );
+ g_free( tagtype );
+ g_free( tagvalue );
+ g_free( tagtemp );
g_free( line );
- line = NULL;
}
/* Free lists */
/* Parse line */
tagtemp = vcard_get_tagname( line, VCARD_SEP_TAG );
- if( tagtemp ) {
- tagvalue = vcard_get_tagvalue( line, VCARD_SEP_TAG );
- tagname = vcard_get_tagname( tagtemp, VCARD_SEP_TYPE );
- tagtype = vcard_get_tagvalue( tagtemp, VCARD_SEP_TYPE );
- if( tagname == NULL ) {
- tagname = tagtemp;
- tagtemp = NULL;
- }
+ if( tagtemp == NULL ) {
+ g_free( line );
+ continue;
+ }
- if( tagvalue ) {
- if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) {
- /* Quoted-Printable: could span multiple lines */
- tagvalue = vcard_read_qp( cardFile, tagvalue );
- vcard_unescape_qp( tagvalue );
- }
- if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 &&
- g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
- haveStart = TRUE;
- }
- if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 &&
- g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
- /* vCard is complete */
- if( haveStart ) cardFile->retVal = MGU_SUCCESS;
- }
- g_free( tagvalue );
- }
- g_free( tagname );
- g_free( tagtype );
+ tagvalue = vcard_get_tagvalue( line, VCARD_SEP_TAG );
+ if( tagvalue == NULL ) {
+ g_free( tagtemp );
+ g_free( line );
+ continue;
+ }
+
+ tagname = vcard_get_tagname( tagtemp, VCARD_SEP_TYPE );
+ tagtype = vcard_get_tagvalue( tagtemp, VCARD_SEP_TYPE );
+ if( tagname == NULL ) {
+ tagname = tagtemp;
+ tagtemp = NULL;
+ }
+
+ if( g_strcasecmp( tagtype, VCARD_TYPE_QP ) == 0 ) {
+ /* Quoted-Printable: could span multiple lines */
+ tagvalue = vcard_read_qp( cardFile, tagvalue );
+ vcard_unescape_qp( tagvalue );
+ }
+ if( g_strcasecmp( tagname, VCARD_TAG_START ) == 0 &&
+ g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
+ haveStart = TRUE;
}
+ if( g_strcasecmp( tagname, VCARD_TAG_END ) == 0 &&
+ g_strcasecmp( tagvalue, VCARD_NAME ) == 0 ) {
+ /* vCard is complete */
+ if( haveStart ) cardFile->retVal = MGU_SUCCESS;
+ }
+
+ g_free( tagname );
+ g_free( tagtype );
+ g_free( tagvalue );
+ g_free( tagtemp );
g_free( line );
- line = NULL;
}
vcard_close_file( cardFile );
}
/*
* End of Source.
*/
-