aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.ja10
-rw-r--r--src/editjpilot.c1
-rw-r--r--src/editvcard.c1
-rw-r--r--src/export.c1
-rw-r--r--src/import.c1
-rw-r--r--src/importcsv.c69
-rw-r--r--src/importldif.c54
-rw-r--r--src/passphrase.c1
9 files changed, 46 insertions, 102 deletions
diff --git a/ChangeLog b/ChangeLog
index 465d815b..546a5a32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2007-04-10
+ * src/importldif.c
+ src/importcsv.c: use GtkFileChooser.
+ * src/passphrase.c
+ src/editjpilot.c
+ src/export.c
+ src/import.c
+ src/editvcard.c: removed redundant includes.
+
+2007-04-10
+
* src/mainwindow.c
src/prefs_filter.c: modified the string "Filter setting" to
"Filter settings".
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 802209b1..7d4e62f5 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,15 @@
2007-04-10
+ * src/importldif.c
+ src/importcsv.c: GtkFileChooser を使用するようにした。
+ * src/passphrase.c
+ src/editjpilot.c
+ src/export.c
+ src/import.c
+ src/editvcard.c: 無駄な include を削除。
+
+2007-04-10
+
* src/mainwindow.c
src/prefs_filter.c: 文字列 "Filter setting" を "Filter settings"
に変更。
diff --git a/src/editjpilot.c b/src/editjpilot.c
index 7775d71e..436d1810 100644
--- a/src/editjpilot.c
+++ b/src/editjpilot.c
@@ -45,7 +45,6 @@
#include <gtk/gtkbutton.h>
#include <gtk/gtkstatusbar.h>
#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkfilesel.h>
#include "addressbook.h"
#include "prefs_common.h"
diff --git a/src/editvcard.c b/src/editvcard.c
index e3def774..b2b020da 100644
--- a/src/editvcard.c
+++ b/src/editvcard.c
@@ -38,7 +38,6 @@
#include <gtk/gtktable.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkstatusbar.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtkhseparator.h>
#include <gtk/gtkstock.h>
diff --git a/src/export.c b/src/export.c
index 581f9a12..246684d2 100644
--- a/src/export.c
+++ b/src/export.c
@@ -35,7 +35,6 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkbutton.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtksignal.h>
#include "main.h"
diff --git a/src/import.c b/src/import.c
index 8e8b3840..139ea18a 100644
--- a/src/import.c
+++ b/src/import.c
@@ -35,7 +35,6 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkbutton.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkstock.h>
diff --git a/src/importcsv.c b/src/importcsv.c
index 7fa0beb7..24f218fc 100644
--- a/src/importcsv.c
+++ b/src/importcsv.c
@@ -42,7 +42,6 @@
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkstatusbar.h>
#include <gtk/gtknotebook.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtkstock.h>
#include <stdio.h>
@@ -50,6 +49,7 @@
#include "addrbook.h"
#include "addressbook.h"
#include "addressitem.h"
+#include "filesel.h"
#include "gtkutils.h"
#include "stock_pixmap.h"
#include "prefs_common.h"
@@ -122,7 +122,6 @@ static struct _ImpCSVAttrib {
{N_("E-Mail Address"), 4, TRUE}
};
-static struct _AddressFileSelection _imp_csv_file_selector_;
static AddressBookFile *_importedBook_;
static AddressIndex *_imp_addressIndex_;
static gint importCount = 0;
@@ -171,7 +170,7 @@ static gchar *imp_csv_guess_file( AddressBookFile *abf ) {
return newFile;
}
-static void imp_csv_load_fields( gchar *sFile ) {
+static gboolean imp_csv_load_fields( gchar *sFile ) {
GtkCList *clist = GTK_CLIST(impcsv_dlg.clist_field);
FILE *fp;
gchar buf[BUFFSIZE];
@@ -180,7 +179,7 @@ static void imp_csv_load_fields( gchar *sFile ) {
gchar **strv;
CharSet enc;
- g_return_if_fail(sFile != NULL);
+ g_return_val_if_fail(sFile != NULL, FALSE);
impcsv_dlg.rowIndSelect = -1;
impcsv_dlg.rowCount = 0;
@@ -189,7 +188,7 @@ static void imp_csv_load_fields( gchar *sFile ) {
enc = conv_check_file_encoding(sFile);
if ((fp = g_fopen(sFile, "rb")) == NULL) {
- return;
+ return FALSE;
}
while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -216,6 +215,8 @@ static void imp_csv_load_fields( gchar *sFile ) {
}
fclose(fp);
+
+ return TRUE;
}
static void imp_csv_field_list_selected( GtkCList *clist, gint row, gint column ) {
@@ -381,8 +382,11 @@ static gboolean imp_csv_file_move() {
}
if( ! errFlag ) {
- imp_csv_load_fields( sFile );
- retVal = TRUE;
+ if ( ! imp_csv_load_fields( sFile ) ) {
+ sMsg = _( "Error reading CSV fields." );
+ } else {
+ retVal = TRUE;
+ }
}
imp_csv_status_show( sMsg );
@@ -463,55 +467,18 @@ static void imp_csv_cancel( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
-static void imp_csv_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(impcsv_dlg.file_entry), sFile );
- gtk_widget_hide( afs->fileSelector );
- gtk_grab_remove( afs->fileSelector );
- gtk_widget_grab_focus( impcsv_dlg.file_entry );
-}
-
-static void imp_csv_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( impcsv_dlg.file_entry );
-}
-
-static void imp_csv_file_select_create( AddressFileSelection *afs ) {
- GtkWidget *fileSelector;
-
- fileSelector = gtk_file_selection_new( _("Select CSV 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 (imp_csv_file_ok), ( gpointer ) afs );
- g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
- "clicked", G_CALLBACK (imp_csv_file_cancel), ( gpointer ) afs );
- afs->fileSelector = fileSelector;
- afs->cancelled = TRUE;
-}
-
static void imp_csv_file_select( void ) {
gchar *sFile;
- if( ! _imp_csv_file_selector_.fileSelector )
- imp_csv_file_select_create( & _imp_csv_file_selector_ );
+ gchar *sSelFile;
sFile = gtk_editable_get_chars( GTK_EDITABLE(impcsv_dlg.file_entry), 0, -1 );
- gtk_file_selection_set_filename(
- GTK_FILE_SELECTION( _imp_csv_file_selector_.fileSelector ),
- sFile );
+ sSelFile = filesel_select_file( _("Select CSV File"), sFile,
+ GTK_FILE_CHOOSER_ACTION_OPEN );
g_free( sFile );
- gtk_widget_show( _imp_csv_file_selector_.fileSelector );
- gtk_grab_add( _imp_csv_file_selector_.fileSelector );
+ if (sSelFile) {
+ gtk_entry_set_text( GTK_ENTRY(impcsv_dlg.file_entry), sSelFile );
+ g_free( sSelFile );
+ }
}
static gint imp_csv_delete_event( GtkWidget *widget, GdkEventAny *event, gpointer data ) {
diff --git a/src/importldif.c b/src/importldif.c
index fe6cc003..d1b392b6 100644
--- a/src/importldif.c
+++ b/src/importldif.c
@@ -41,12 +41,12 @@
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkstatusbar.h>
#include <gtk/gtknotebook.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtkstock.h>
#include "addrbook.h"
#include "addressbook.h"
#include "addressitem.h"
+#include "filesel.h"
#include "gtkutils.h"
#include "stock_pixmap.h"
#include "prefs_common.h"
@@ -99,7 +99,6 @@ static struct _ImpLdif_Dlg {
gboolean cancelled;
} impldif_dlg;
-static struct _AddressFileSelection _imp_ldif_file_selector_;
static AddressBookFile *_importedBook_;
static AddressIndex *_imp_addressIndex_;
static LdifFile *_ldifFile_ = NULL;
@@ -420,55 +419,18 @@ static void imp_ldif_cancel( GtkWidget *widget, gpointer data ) {
gtk_main_quit();
}
-static void imp_ldif_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(impldif_dlg.file_entry), sFile );
- gtk_widget_hide( afs->fileSelector );
- gtk_grab_remove( afs->fileSelector );
- gtk_widget_grab_focus( impldif_dlg.file_entry );
-}
-
-static void imp_ldif_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( impldif_dlg.file_entry );
-}
-
-static void imp_ldif_file_select_create( AddressFileSelection *afs ) {
- GtkWidget *fileSelector;
-
- fileSelector = gtk_file_selection_new( _("Select LDIF 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 (imp_ldif_file_ok), ( gpointer ) afs );
- g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
- "clicked", G_CALLBACK (imp_ldif_file_cancel), ( gpointer ) afs );
- afs->fileSelector = fileSelector;
- afs->cancelled = TRUE;
-}
-
static void imp_ldif_file_select( void ) {
gchar *sFile;
- if( ! _imp_ldif_file_selector_.fileSelector )
- imp_ldif_file_select_create( & _imp_ldif_file_selector_ );
+ gchar *sSelFile;
sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.file_entry), 0, -1 );
- gtk_file_selection_set_filename(
- GTK_FILE_SELECTION( _imp_ldif_file_selector_.fileSelector ),
- sFile );
+ sSelFile = filesel_select_file( _("Select LDIF File"), sFile,
+ GTK_FILE_CHOOSER_ACTION_OPEN );
g_free( sFile );
- gtk_widget_show( _imp_ldif_file_selector_.fileSelector );
- gtk_grab_add( _imp_ldif_file_selector_.fileSelector );
+ if ( sSelFile ) {
+ gtk_entry_set_text( GTK_ENTRY(impldif_dlg.file_entry), sSelFile );
+ g_free( sSelFile );
+ }
}
static gint imp_ldif_delete_event( GtkWidget *widget, GdkEventAny *event, gpointer data ) {
diff --git a/src/passphrase.c b/src/passphrase.c
index 40a3bb1e..3db5a3a3 100644
--- a/src/passphrase.c
+++ b/src/passphrase.c
@@ -39,7 +39,6 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkhbbox.h>
#include <gtk/gtkbutton.h>
-#include <gtk/gtkfilesel.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkstock.h>
#include <string.h>