/* * pglogGetForeignRelSize * Obtain relation size estimates for a foreign table */ static void pglogGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid) { PgLogPlanState *fdw_private; elog(DEBUG1,"Entering function %s",__func__); /* * Fetch options. We only need filenames at this point, but we might as * well get everything and not need to re-fetch it later in planning. */ fdw_private = (PgLogPlanState *) palloc(sizeof(PgLogPlanState)); fdw_private->i = 0; fdw_private->filenames = initLogFileNames(Pglog_directory); baserel->fdw_private = (void *) fdw_private; /* Estimate relation size */ estimate_size(root, baserel, fdw_private); }
static gboolean verify_source_location_contents (const char *text_uri, guint64 *size_out, GList **images, GError **error) { GList *unreadable_paths = NULL; GList *image_paths = NULL; NcbRenameDialog *rename_dialog; gboolean only_images; gint64 size; int res; if (images != NULL) { *images = NULL; } size = estimate_size (text_uri, &unreadable_paths, &image_paths, &only_images); rename_dialog = ncb_rename_dialog_new (); g_signal_connect (G_OBJECT (rename_dialog), "response", (GCallback)ncb_rename_dialog_response_cb, NULL); /* Display the rename dialog if there are invalid filenames in * BURN_URI. */ if (ncb_rename_dialog_set_invalid_filenames (rename_dialog, BURN_URI)) { /* The dialog renames the files directly in BURN_URI * for us. */ res = gtk_dialog_run (GTK_DIALOG (rename_dialog)); if (res == GTK_RESPONSE_CANCEL) { gtk_widget_destroy (GTK_WIDGET (rename_dialog)); return FALSE; } } gtk_widget_destroy (GTK_WIDGET (rename_dialog)); if (only_images == TRUE && size != 0) { GtkWidget *dialog; char *msg; if (g_list_length (image_paths) == 1) { msg = g_strdup (_("It appears that the disc, when created, will contain a single disc image file. " "Do you want to create a disc from the contents of the image or with the image file inside?")); dialog = ncb_hig_dialog (GTK_MESSAGE_QUESTION, _("Create disc containing a single disc image file?"), msg, NULL); gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("Create From Image"), GTK_RESPONSE_NO, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Create With File"), GTK_RESPONSE_YES, NULL); } else { msg = g_strdup (_("It appears that the disc, when created, will contain only disc image files. " "Do you want to continue and write them to the disc as files?")); dialog = ncb_hig_dialog (GTK_MESSAGE_QUESTION, _("Create disc containing only disc image files?"), msg, NULL); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Create With Files"), GTK_RESPONSE_YES, NULL); } g_free (msg); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); res = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (res == GTK_RESPONSE_NO) { if (images != NULL) { *images = image_paths; } else { g_list_foreach (image_paths, (GFunc)g_free, NULL); g_list_free (image_paths); } return FALSE; } else if (res == GTK_RESPONSE_CANCEL) { g_list_foreach (image_paths, (GFunc)g_free, NULL); g_list_free (image_paths); return FALSE; } } if (unreadable_paths != NULL) { GList *l; for (l = unreadable_paths; l; l = l->next) { GtkWidget *dialog; char *msg; msg = g_strdup_printf (_("The file '%s' is unreadable. Do you wish to skip this file and continue?"), (char *)l->data); dialog = ncb_hig_dialog (GTK_MESSAGE_WARNING, _("Skip unreadable file?"), msg, NULL); g_free (msg); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("Skip"), GTK_RESPONSE_ACCEPT, _("Skip All"), GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); res = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (res == GTK_RESPONSE_ACCEPT) { } else if (res == GTK_RESPONSE_YES) { break; } else { /* cancel */ g_list_foreach (unreadable_paths, (GFunc)g_free, NULL); g_list_free (unreadable_paths); return FALSE; } } g_list_foreach (unreadable_paths, (GFunc)g_free, NULL); g_list_free (unreadable_paths); } if (size <= 0) { g_set_error (error, NCB_SELECTION_ERROR, NCB_SELECTION_ERROR_SOURCE_INVALID, _("No files were selected.")); return FALSE; } if (size_out) { *size_out = size; } return TRUE; }