2005-07-11 [paul] 1.9.12cvs34
authorPaul Mangan <paul@claws-mail.org>
Mon, 11 Jul 2005 08:55:49 +0000 (08:55 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 11 Jul 2005 08:55:49 +0000 (08:55 +0000)
sync with main

* src/account.c
account_delete(): modified alert dialog
* src/editjpilot.c
* src/editvcard.c
fixed a crash when cancelling file selection
dialog by Escape key. Made non-ascii filename
selectable.
* src/prefs_template.c
prefs_template_window_create(): make scrolled
window policy AUTOMATIC

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/account.c
src/editjpilot.c
src/editvcard.c
src/prefs_template.c

index 8fede23..d8968c5 100644 (file)
@@ -1,3 +1,18 @@
+2005-07-11 [paul]      1.9.12cvs34
+
+       sync with main
+
+       * src/account.c
+               account_delete(): modified alert dialog
+       * src/editjpilot.c
+       * src/editvcard.c
+               fixed a crash when cancelling file selection
+               dialog by Escape key. Made non-ascii filename
+               selectable.
+       * src/prefs_template.c
+               prefs_template_window_create(): make scrolled
+               window policy AUTOMATIC
+
 2005-07-10 [hoa]       1.9.12cvs33
 
        * src/etpan/imap-thread.c
index 4f2d47e..cfe90e8 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.51 -r 1.179.2.52 src/imap.c;  cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/etpan/imap-thread.c;  ) > 1.9.12cvs31.patchset
 ( cvs diff -u -r 1.213.2.40 -r 1.213.2.41 src/folder.c;  cvs diff -u -r 1.179.2.52 -r 1.179.2.53 src/imap.c;  cvs diff -u -r 1.34.2.1 -r 1.34.2.2 src/imap.h;  cvs diff -u -r 1.5.2.4 -r 1.5.2.5 src/statusbar.c;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 src/statusbar.h;  cvs diff -u -r 1.1.4.5 -r 1.1.4.6 src/etpan/imap-thread.c;  ) > 1.9.12cvs32.patchset
 ( cvs diff -u -r 1.1.4.6 -r 1.1.4.7 src/etpan/imap-thread.c;  ) > 1.9.12cvs33.patchset
+( cvs diff -u -r 1.61.2.28 -r 1.61.2.29 src/account.c;  cvs diff -u -r 1.5.12.3 -r 1.5.12.4 src/editjpilot.c;  cvs diff -u -r 1.5.12.3 -r 1.5.12.4 src/editvcard.c;  cvs diff -u -r 1.12.2.12 -r 1.12.2.13 src/prefs_template.c;  ) > 1.9.12cvs34.patchset
index dc3ebb0..d2c963d 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=33
+EXTRA_VERSION=34
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 566fde4..ad40cc0 100644 (file)
@@ -931,6 +931,7 @@ static void account_clone(GtkWidget *widget, gpointer data)
 static void account_delete(GtkWidget *widget, gpointer data)
 {
        PrefsAccount *ac_prefs;
+       gchar buf[BUFFSIZE];
        GList *list;
        Folder *folder;
  
@@ -938,8 +939,11 @@ static void account_delete(GtkWidget *widget, gpointer data)
        if (ac_prefs == NULL)
                return;
 
-       if (alertpanel(_("Delete account"),
-                      _("Do you really want to delete this account?"),
+       g_snprintf(buf, sizeof(buf),
+                  _("Do you really want to delete the account '%s'?"),
+                  ac_prefs->account_name ? ac_prefs->account_name :
+                  _("(Untitled)"));
+       if (alertpanel(_("Delete account"), buf,
                       _("Yes"), _("+No"), NULL) != G_ALERTDEFAULT)
                return;
 
index 565e21b..8f37b8c 100644 (file)
 #include <gtk/gtklabel.h>
 #include <gtk/gtkentry.h>
 #include <gtk/gtkhbbox.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtktable.h>
+#include <gtk/gtkframe.h>
+#include <gtk/gtkhseparator.h>
 #include <gtk/gtkbutton.h>
+#include <gtk/gtkstatusbar.h>
+#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtkfilesel.h>
 
 #include "addressbook.h"
 #include "prefs_common.h"
 #include "addressitem.h"
 #include "jpilot.h"
 #include "mgutils.h"
+#include "filesel.h"
 #include "gtkutils.h"
+#include "codeconv.h"
 #include "manage_window.h"
 
 #define ADDRESSBOOK_GUESS_JPILOT "MyJPilot"
@@ -63,8 +72,6 @@ static struct _JPilotEdit {
        gint status_cid;
 } jpilotedit;
 
-static struct _AddressFileSelection jpilot_file_selector;
-
 /*
 * Edit functions.
 */
@@ -156,16 +163,18 @@ static void edit_jpilot_read_check_box( JPilotFile *pilotFile ) {
 static void edit_jpilot_file_check( void ) {
        gint t = -1;
        gchar *sFile;
+       gchar *sFSFile;
        gchar *sMsg;
        gboolean flg;
 
        flg = FALSE;
        sFile = gtk_editable_get_chars( GTK_EDITABLE(jpilotedit.file_entry), 0, -1 );
        if( sFile ) {
-               g_strchomp( sFile ); g_strchug( sFile );
-               if( *sFile != '\0' ) {
+               sFSFile = conv_filename_from_utf8( sFile );
+               if( sFSFile && *sFSFile != '\0' ) {
                        /* Attempt to read file */
-                       JPilotFile *jpf = jpilot_create_path( sFile );
+                       JPilotFile *jpf;
+                       jpf = jpilot_create_path( sFSFile );
                        t = jpilot_read_data( jpf );
                        if( t == MGU_SUCCESS ) {
                                /* Set check boxes */
@@ -175,12 +184,13 @@ static void edit_jpilot_file_check( void ) {
                        jpilot_free( jpf );
                        jpf = NULL;
                }
+               g_free( sFSFile );
+               g_free( sFile );
        }
        if( ! flg ) {
                /* Clear all check boxes */
                edit_jpilot_fill_check_box_new();
        }
-       g_free( sFile );
 
        /* Display appropriate message */
        if( t == MGU_SUCCESS ) {
@@ -195,55 +205,19 @@ static void edit_jpilot_file_check( void ) {
        edit_jpilot_status_show( sMsg );
 }
 
-static void edit_jpilot_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(jpilotedit.file_entry), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       edit_jpilot_file_check();
-       gtk_widget_grab_focus( jpilotedit.file_entry );
-}
-
-static void edit_jpilot_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( jpilotedit.file_entry );
-}
-
-static void edit_jpilot_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select JPilot File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->ok_button),
-                         "clicked", G_CALLBACK (edit_jpilot_file_ok), ( gpointer ) afs );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                         "clicked", G_CALLBACK (edit_jpilot_file_cancel), ( gpointer ) afs );
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
-}
-
 static void edit_jpilot_file_select( void ) {
        gchar *sFile;
+       gchar *sUTF8File;
 
-       if (! jpilot_file_selector.fileSelector )
-               edit_jpilot_file_select_create( & jpilot_file_selector );
+       sFile = filesel_select_file( _("Select JPilot File"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN );
 
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(jpilotedit.file_entry), 0, -1 );
-       gtk_file_selection_set_filename( GTK_FILE_SELECTION( jpilot_file_selector.fileSelector ), sFile );
-       g_free( sFile );
-       gtk_widget_show( jpilot_file_selector.fileSelector );
-       gtk_grab_add( jpilot_file_selector.fileSelector );
+       if( sFile ) {
+               sUTF8File = conv_filename_to_utf8( sFile );
+               gtk_entry_set_text( GTK_ENTRY(jpilotedit.file_entry), sUTF8File );
+               g_free( sUTF8File );
+               g_free( sFile );
+               edit_jpilot_file_check();
+       }
 }
 
 static void addressbook_edit_jpilot_create( gboolean *cancelled ) {
@@ -380,6 +354,7 @@ AdapterDSource *addressbook_edit_jpilot( AddressIndex *addrIndex, AdapterDSource
        static gboolean cancelled;
        gchar *sName;
        gchar *sFile;
+       gchar *sFSFile;
        AddressDataSource *ds = NULL;
        JPilotFile *jpf = NULL;
        gboolean fin;
@@ -421,8 +396,10 @@ AdapterDSource *addressbook_edit_jpilot( AddressIndex *addrIndex, AdapterDSource
        fin = FALSE;
        sName = gtk_editable_get_chars( GTK_EDITABLE(jpilotedit.name_entry), 0, -1 );
        sFile = gtk_editable_get_chars( GTK_EDITABLE(jpilotedit.file_entry), 0, -1 );
+       sFSFile = conv_filename_from_utf8( sFile );
        if( *sName == '\0' ) fin = TRUE;
        if( *sFile == '\0' ) fin = TRUE;
+       if( ! sFSFile || *sFSFile == '\0' ) fin = TRUE;
 
        if( ! fin ) {
                if( ! ads ) {
@@ -432,11 +409,12 @@ AdapterDSource *addressbook_edit_jpilot( AddressIndex *addrIndex, AdapterDSource
                }
                addressbook_ads_set_name( ads, sName );
                jpilot_set_name( jpf, sName );
-               jpilot_set_file( jpf, sFile );
+               jpilot_set_file( jpf, sFSFile );
                edit_jpilot_read_check_box( jpf );
        }
-       g_free( sName );
+       g_free( sFSFile );
        g_free( sFile );
+       g_free( sName );
 
        return ads;
 }
index 4628b61..d4cb1ac 100644 (file)
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkwindow.h>
 #include <gtk/gtksignal.h>
+#include <gtk/gtkvbox.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtkentry.h>
 #include <gtk/gtktable.h>
 #include <gtk/gtkbutton.h>
+#include <gtk/gtkstatusbar.h>
+#include <gtk/gtkfilesel.h>
+#include <gtk/gtkhseparator.h>
+#include <gtk/gtkstock.h>
 
 #include "addressbook.h"
 #include "prefs_common.h"
 #include "addressitem.h"
 #include "vcard.h"
 #include "mgutils.h"
+#include "filesel.h"
 #include "gtkutils.h"
+#include "codeconv.h"
 #include "manage_window.h"
 
 #define ADDRESSBOOK_GUESS_VCARD  "MyGnomeCard"
@@ -57,8 +64,6 @@ static struct _VCardEdit {
        gint status_cid;
 } vcardedit;
 
-static struct _AddressFileSelection vcard_file_selector;
-
 /*
 * Edit functions.
 */
@@ -84,10 +89,13 @@ static void edit_vcard_cancel( GtkWidget *widget, gboolean *cancelled ) {
 static void edit_vcard_file_check( void ) {
        gint t;
        gchar *sFile;
+       gchar *sFSFile;
        gchar *sMsg;
 
        sFile = gtk_editable_get_chars( GTK_EDITABLE(vcardedit.file_entry), 0, -1 );
-       t = vcard_test_read_file( sFile );
+       sFSFile = conv_filename_from_utf8( sFile );
+       t = vcard_test_read_file( sFSFile );
+       g_free( sFSFile );
        g_free( sFile );
        if( t == MGU_SUCCESS ) {
                sMsg = "";
@@ -101,55 +109,19 @@ static void edit_vcard_file_check( void ) {
        edit_vcard_status_show( sMsg );
 }
 
-static void edit_vcard_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(vcardedit.file_entry), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       edit_vcard_file_check();
-       gtk_widget_grab_focus( vcardedit.file_entry );
-}
-
-static void edit_vcard_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( vcardedit.file_entry );
-}
-
-static void edit_vcard_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select vCard File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->ok_button),
-                         "clicked", G_CALLBACK (edit_vcard_file_ok), ( gpointer ) afs );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                         "clicked", G_CALLBACK (edit_vcard_file_cancel), ( gpointer ) afs );
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
-}
-
 static void edit_vcard_file_select( void ) {
        gchar *sFile;
+       gchar *sUTF8File;
 
-       if (! vcard_file_selector.fileSelector )
-               edit_vcard_file_select_create( & vcard_file_selector );
+       sFile = filesel_select_file_open( _("Select vCard File"), NULL);
 
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(vcardedit.file_entry), 0, -1 );
-       gtk_file_selection_set_filename( GTK_FILE_SELECTION( vcard_file_selector.fileSelector ), sFile );
-       g_free( sFile );
-       gtk_widget_show( vcard_file_selector.fileSelector );
-       gtk_grab_add( vcard_file_selector.fileSelector );
+       if( sFile ) {
+               sUTF8File = conv_filename_to_utf8( sFile );
+               gtk_entry_set_text( GTK_ENTRY(vcardedit.file_entry), sUTF8File );
+               g_free( sUTF8File );
+               g_free( sFile );
+               edit_vcard_file_check();
+       }
 }
 
 static gint edit_vcard_delete_event( GtkWidget *widget, GdkEventAny *event, gboolean *cancelled ) {
@@ -271,6 +243,7 @@ AdapterDSource *addressbook_edit_vcard( AddressIndex *addrIndex, AdapterDSource
        static gboolean cancelled;
        gchar *sName;
        gchar *sFile;
+       gchar *sFSFile;
        AddressDataSource *ds = NULL;
        VCardFile *vcf = NULL;
        gboolean fin;
@@ -305,8 +278,10 @@ AdapterDSource *addressbook_edit_vcard( AddressIndex *addrIndex, AdapterDSource
        fin = FALSE;
        sName = gtk_editable_get_chars( GTK_EDITABLE(vcardedit.name_entry), 0, -1 );
        sFile = gtk_editable_get_chars( GTK_EDITABLE(vcardedit.file_entry), 0, -1 );
+       sFSFile = conv_filename_from_utf8( sFile );
        if( *sName == '\0' ) fin = TRUE;
        if( *sFile == '\0' ) fin = TRUE;
+       if( ! sFSFile || *sFSFile == '\0' ) fin = TRUE;
 
        if( ! fin ) {
                if( ! ads ) {
@@ -316,10 +291,11 @@ AdapterDSource *addressbook_edit_vcard( AddressIndex *addrIndex, AdapterDSource
                }
                addressbook_ads_set_name( ads, sName );
                vcard_set_name( vcf, sName );
-               vcard_set_file( vcf, sFile );
+               vcard_set_file( vcf, sFSFile );
        }
-       g_free( sName );
+       g_free( sFSFile );
        g_free( sFile );
+       g_free( sName );
 
        return ads;
 }
index 5304e4c..d65a01b 100644 (file)
@@ -199,8 +199,10 @@ static void prefs_template_window_create(void)
        scroll2 = gtk_scrolled_window_new(NULL, NULL);
        gtk_widget_show(scroll2);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll2),
-                                      GTK_POLICY_NEVER,
+                                      GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll2),
+                                           GTK_SHADOW_IN);
        gtk_box_pack_start(GTK_BOX(vbox1), scroll2, TRUE, TRUE, 0);
 
        text_value = gtk_text_view_new();