diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-27 23:13:25 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-29 00:13:23 +0800 |
commit | fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch) | |
tree | ae78be371695c3dc18847b87d3f014f985aa3a40 /plugins/backup-restore | |
parent | 6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff) | |
download | gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip |
Prefer GLib basic types over C types.
Diffstat (limited to 'plugins/backup-restore')
-rw-r--r-- | plugins/backup-restore/backup-restore.c | 38 | ||||
-rw-r--r-- | plugins/backup-restore/backup.c | 58 |
2 files changed, 48 insertions, 48 deletions
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index 59c04a605b..92d36e71d8 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -52,7 +52,7 @@ typedef enum _br_flags { }br_flags; static void -backup (const char *filename, gboolean restart) +backup (const gchar *filename, gboolean restart) { if (restart) execl (EVOLUTION_TOOLSDIR "/evolution-backup", "evolution-backup", "--gui", "--backup", "--restart", filename, NULL); @@ -61,7 +61,7 @@ backup (const char *filename, gboolean restart) } static void -restore (const char *filename, gboolean restart) +restore (const gchar *filename, gboolean restart) { if (restart) execl (EVOLUTION_TOOLSDIR "/evolution-backup", "evolution-backup", "--gui", "--restore", "--restart", filename, NULL); @@ -70,10 +70,10 @@ restore (const char *filename, gboolean restart) } static gboolean -sanity_check (const char *filename) +sanity_check (const gchar *filename) { - char *command; - int result; + gchar *command; + gint result; command = g_strdup_printf ("%s/evolution-backup --check %s", EVOLUTION_TOOLSDIR, filename); result = system (command); @@ -89,11 +89,11 @@ sanity_check (const char *filename) } static guint32 -dialog_prompt_user(GtkWindow *parent, const char *string, const char *tag, const char *arg0, ...) +dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, const gchar *arg0, ...) { GtkWidget *mbox, *check = NULL; va_list ap; - int button; + gint button; guint32 mask = 0; va_start(ap, arg0); @@ -120,7 +120,7 @@ dialog_prompt_user(GtkWindow *parent, const char *string, const char *tag, const } static gboolean -epbr_perform_pre_backup_checks (char* dir) +epbr_perform_pre_backup_checks (gchar * dir) { #ifdef G_OS_WIN32 return TRUE; @@ -134,7 +134,7 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) { GtkWidget *dlg; GtkWidget *vbox; - int response; + gint response; dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE); @@ -150,10 +150,10 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) response = gtk_dialog_run (GTK_DIALOG (dlg)); if (response == GTK_RESPONSE_OK) { - char *filename; + gchar *filename; guint32 mask; - char *uri = NULL; - char *dir; + gchar *uri = NULL; + gchar *dir; uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dlg)); e_file_update_save_path(uri, TRUE); @@ -186,7 +186,7 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) { GtkWidget *dlg; GtkWidget *vbox; - int response; + gint response; dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file to restore"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN); @@ -200,8 +200,8 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) response = gtk_dialog_run (GTK_DIALOG (dlg)); if (response == GTK_RESPONSE_OK) { - char *filename; - char *uri = NULL; + gchar *filename; + gchar *uri = NULL; uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dlg)); e_file_update_save_path(uri, TRUE); @@ -232,7 +232,7 @@ check_toggled (GtkToggleButton *button, GnomeDruid *druid) { GtkWidget *box = g_object_get_data ((GObject *)button, "box"); gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); - char *prevfile = g_object_get_data ((GObject *)druid, "restore-file"); + gchar *prevfile = g_object_get_data ((GObject *)druid, "restore-file"); gtk_widget_set_sensitive (box, state); gnome_druid_set_show_finish (druid, state); @@ -249,7 +249,7 @@ static void restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data) { gboolean state = GPOINTER_TO_INT(g_object_get_data((GObject *)druid, "restore")) ? TRUE:FALSE; - char *file = g_object_get_data ((GObject *)druid, "restore-file"); + gchar *file = g_object_get_data ((GObject *)druid, "restore-file"); if (state) { if (!file ||!sanity_check (file)) { @@ -263,8 +263,8 @@ restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data static void file_changed (GtkFileChooser *chooser, GnomeDruid *druid) { - char *file = NULL, *prevfile=NULL; - char *uri = NULL; + gchar *file = NULL, *prevfile=NULL; + gchar *uri = NULL; uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (chooser)); e_file_update_save_path(uri, TRUE); diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c index 19e9e98bb1..67dea3e6a3 100644 --- a/plugins/backup-restore/backup.c +++ b/plugins/backup-restore/backup.c @@ -43,18 +43,18 @@ #define ARCHIVE_NAME "evolution-backup.tar.gz" static gboolean backup_op = FALSE; -static char *bk_file = NULL; +static gchar *bk_file = NULL; static gboolean restore_op = FALSE; -static char *res_file = NULL; +static gchar *res_file = NULL; static gboolean check_op = FALSE; -static char *chk_file = NULL; +static gchar *chk_file = NULL; static gboolean restart_arg = FALSE; static gboolean gui_arg = FALSE; static gchar **opt_remaining = NULL; -static int result=0; +static gint result=0; static GtkWidget *progress_dialog; static GtkWidget *pbar; -static char *txt = NULL; +static gchar *txt = NULL; gboolean complete = FALSE; static GOptionEntry options[] = { @@ -80,11 +80,11 @@ static GOptionEntry options[] = { #define CANCEL(x) if (x) return; static GString * -replace_string (const char *text, const char *find, const char *replace) +replace_string (const gchar *text, const gchar *find, const gchar *replace) { - const char *p, *next; + const gchar *p, *next; GString *str; - int find_len; + gint find_len; g_return_val_if_fail (text != NULL, NULL); g_return_val_if_fail (find != NULL, NULL); @@ -110,9 +110,9 @@ replace_string (const char *text, const char *find, const char *replace) } static void -replace_in_file (const char *filename, const char *find, const char *replace) +replace_in_file (const gchar *filename, const gchar *find, const gchar *replace) { - char *content = NULL; + gchar *content = NULL; GError *error = NULL; GString *filenamestr = NULL; @@ -157,7 +157,7 @@ replace_in_file (const char *filename, const char *find, const char *replace) } static void -run_cmd (const char *cmd) +run_cmd (const gchar *cmd) { if (!cmd) return; @@ -175,10 +175,10 @@ run_cmd (const char *cmd) } static void -backup (const char *filename) +backup (const gchar *filename) { - char *command; - char *quotedfname; + gchar *command; + gchar *quotedfname; g_return_if_fail (filename && *filename); quotedfname = g_shell_quote(filename); @@ -222,10 +222,10 @@ backup (const char *filename) } static void -restore (const char *filename) +restore (const gchar *filename) { - char *command; - char *quotedfname; + gchar *command; + gchar *quotedfname; g_return_if_fail (filename && *filename); quotedfname = g_shell_quote(filename); @@ -274,10 +274,10 @@ restore (const char *filename) } static void -check (const char *filename) +check (const gchar *filename) { - char *command; - char *quotedfname; + gchar *command; + gchar *quotedfname; g_return_if_fail (filename && *filename); quotedfname = g_shell_quote(filename); @@ -359,10 +359,10 @@ dlg_response (GtkWidget *dlg, gint response, gpointer data) gtk_main_quit (); } -int -main (int argc, char **argv) +gint +main (gint argc, gchar **argv) { - char *file = NULL, *oper = NULL; + gchar *file = NULL, *oper = NULL; gint i; GError *error = NULL; @@ -384,17 +384,17 @@ main (int argc, char **argv) for (i = 0; i < g_strv_length (opt_remaining); i++) { if (backup_op) { oper = _("Backing up to the folder %s"); - d(g_message ("Backing up to the folder %s", (char *) opt_remaining[i])); - bk_file = g_strdup ((char *) opt_remaining[i]); + d(g_message ("Backing up to the folder %s", (gchar *) opt_remaining[i])); + bk_file = g_strdup ((gchar *) opt_remaining[i]); file = bk_file; } else if (restore_op) { oper = _("Restoring from the folder %s"); - d(g_message ("Restoring from the folder %s", (char *) opt_remaining[i])); - res_file = g_strdup ((char *) opt_remaining[i]); + d(g_message ("Restoring from the folder %s", (gchar *) opt_remaining[i])); + res_file = g_strdup ((gchar *) opt_remaining[i]); file = res_file; } else if (check_op) { - d(g_message ("Checking %s", (char *) opt_remaining[i])); - chk_file = g_strdup ((char *) opt_remaining[i]); + d(g_message ("Checking %s", (gchar *) opt_remaining[i])); + chk_file = g_strdup ((gchar *) opt_remaining[i]); } } } |